I have some several proxies for my api calls through nginx. For example
http://localhost:5000/application/api1/get/user will be redirected to
https://example.com/application/api1/get/user
location ~* "^/api1" {
proxy_pass https://example.com;
}
Now I have to redirect some calls from:
http://localhost:5000/application/api2/get/data to https://example.com/api2/get/data
Note: That I do not need the application this time...
I have tried this :
location ~* "^/api2" {
rewrite ^/application/(.*) /$1
proxy_pass https://example.com;
}
But it does not seem to work :(
you can try this...
location /application/api2/ {
include proxy_params;
proxy_set_header X-Forwarded-Proto https;
proxy_pass https://example.com/api2/;
}
we can discuss further too...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.