I assume that you are using proxy_pass without a URI. In this case, nginx passes the original URI as it was, not normalized. Therefore, you should use proxy_pass http://backend/;
UPDATE
So, I was right. Just add the URI part to proxy_pass as follows:
location = /a { proxy_pass http://127.0.0.1:8080/a; ... } location ^~ /a/ { proxy_pass http:
As indicated in the nginx documentation , if proxy_pass used without a URI (i.e. without a path after the server: port), nginx will put the URI from the original request in the same way as with all double slashes, ../ etc.
On the other hand, the URI in proxy_pass acts like alias , meaning that nginx will replace the part that matches the location prefix (in (I intentionally did the same as the location prefix), so the URI will be the same as the requested one, but normalized (without collages of shares and all this staff). Be careful with the final slashes. Nginx literally replaces the part, and you can get some strange url.
Here is an example with a trailing slash in location , but don't scroll in proxy_pass .
location /one/ { proxy_pass http://127.0.0.1:8080/two; ... }
if you go to the address http://yourserver.com/one/path/here?param=1 nginx will ask for a proxy server for http://127.0.0.1/twopath/here?param=1 . See How two and path combine.
Alexey ten
source share