proxy_pass generates double slash

rainer at ultra-secure.de rainer at ultra-secure.de
Thu Sep 29 08:27:29 UTC 2016


Hi,


I need to proxy a location and remove the location-URL at the same time.

As I found out, this is achieved by adding a slash at the end of the 
proxy_pass directive.

This works almost as intended, but it adds a double-slash to the 
beginning of the URL as it arrives on the other server.


So, if /bla/hence/here/index.php is requested, what arrives on the other 
server is really //hence/here/index.php.


location /bla {

   proxy_pass https://target:4444/;

}
...


Does anybody have a solution for this?
I have another site where this is no problem (because the target is yet 
another nginx that just compacts the double-slashes (I assume).

However, this time the target is a node.js app that I have no control 
over - and it obviously can't really make sense of this, resulting in a 
404.

Personally, I consider this a bug on the side of the node.js app - but I 
would hope there is a way to remove that double-slash on the nginx-side.


Thanks in advance.



More information about the nginx mailing list