When configuring proxy_pass proxy forwarding in nginx, if you add / to the url behind proxy_pass, it means the absolute root path; if there is no /, it means the relative path, and the matching path part is also sent to the proxy.
The following four cases are accessed by http://192.168.1.1/proxy/test.html respectively.
The first:
location /proxy/ {
proxy_pass http://127.0.0.1/;
}
Proxy to URL: http://127.0.0.1/test.html
The second (relative to the first, the last one less / )
location /proxy/ {
proxy_pass http://127.0.0.1;
}
Proxy to URL: http://127.0.0.1/proxy/test.html
The third:
location /proxy/ {
proxy_pass http://127.0.0.1/aaa/;
}
Proxy to URL: http://127.0.0.1/aaa/test.html
The fourth (relative to the third, the last one less / )
location /proxy/ {
proxy_pass http://127.0.0.1/aaa;
}
Proxy to URL: http://127.0.0.1/aaatest.html