I have original url like https://sourceURL/api/fcst/login/login?ProCode=420000, I want config the proxy_pass let it forward to https://targetURL/pestiot/api/fcst/login/login?ProCode=420000。
Here is my current config
location ~ ^/api {
if ($request_uri ~* "ProCode=420000") {
rewrite ^(/api/fcst.*)$ /pestiot$1 break;
proxy_pass https://targetURL;
break;
}
}
It seems this always can't work. The pestiot doesn't exist in final target whole url. Currently,
- when I use
https://sourceURL/api/fcst/login/login?ProCode=420000the response is 403 Forbidden. - But
https://targetURL/pestiot/api/fcst/login/login?ProCode=420000works - and
https://targetURL/api/fcst/login/login?ProCode=420000response 404