Answer the question
In order to leave comments, you need to log in
How to redirect inside proxy_pass in nginx?
location added to nginx
for https://examle.com/
:
location /test/ {
proxy_pass proxy:5601 ;
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
}
When you go to https://examle.com/test , proxy_pass is triggered, inside proxy:5601 redirection to proxy:5601/app/page is triggered and in the browser we see the link https://examle.com/app/page/, respectively, nginx does not know this location, how to correctly set location so that redirects inside proxy_pass work out?
Answer the question
In order to leave comments, you need to log in
https://nginx.org/ru/docs/http/ngx_http_proxy_modu...
If the URI is changed inside the proxied location using the rewrite directive, and the request will be processed with this configuration (break):
location /name/ {
rewrite /name/([^/]+) /users?name=$1 break;
proxy_pass http://127.0.0.1;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question