nginx upstream proxy with trailing slash
For whatever reason when using nginx as a reverse proxy when combined with upstream and proxy_redirect off, nginx would 301 redirect requests without a trailing slash to the name of the upstream.
That is...
upstream my_upstream { ... } location /something { ... proxy ... } Would result in requests to http://example.com/something getting permanently redirected to http://my_upstream/something/ instead of http://example.com/something/
The solution is to create these redirects manually with additional location { ... } blocks that do the redirect.
location ~* \/(something|somethingelse)$ { return 301 http://$host$request_uri; } location ~* \/(something|somethingelse) { ... proxy_pass http://my_upstream; }













