Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1854

How can I rewrite and proxy in if statement

$
0
0

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=420000 the response is same with https://targetURL/api/fcst/login/login?ProCode=420000


Viewing all articles
Browse latest Browse all 1854

Trending Articles