Every time I try foobar.com/test in browser, nginx seems to redirect (301) the client to foobar.com/test/. This behaviour is unacceptable. The proxied server is a remote Apache web server. I have tried direct calls to the Apache server (without a proxy), and it does not redirect the client.
Considering the nginx server configuration below, any idea how should I solve this?
server {
listen 80;
server_name fooBar.com;
location /test {
proxy_redirect off;
proxy_pass http://1.1.1.1:80/;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /test/ {
proxy_redirect off;
proxy_pass http://1.1.1.1:80/;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}