nginx reverse proxy folder
The issue is that when you use a trailing slash with the proxy_pass
directive, the default behaviour for proxy_redirect
is that the following :
location /test/ {
proxy_pass http://192.168.1.202/;
proxy_set_header Host $host;
}
Is the same as :
location /test/ {
proxy_pass http://192.168.1.202/;
proxy_redirect http://192.168.1.202/ /test/;
proxy_set_header Host $host;
}
So given the curl output, you must set this up :
location /test/ {
proxy_pass http://192.168.1.202/;
proxy_redirect http://$host/ /test/;
proxy_set_header Host $host;
}