missing $uri when performing proxy_pass ??

Maxim Dounin mdounin at mdounin.ru
Fri Feb 6 04:49:11 MSK 2009


On Fri, Feb 06, 2009 at 01:06:37AM +0000, Thomas Mangin wrote:

> I think I hit a bug (and found a workaround) however as I may be  
> mistaken, I would appreciate if someone could review this and let me  
> know if the behaviour observed is normal or not.


> I got around the problem by changing the proxy_pass for http:// 
> $backend/$uri but it was my impression that this should not be needed as 
> without trailing / the uri would be appended.

No.  There are 3 forms of proxy_pass currently:

    proxy_pass http://backend;
    proxy_pass http://backend/path/;
    proxy_pass http://$variables;

First two forms will append uri automatically (without or with 
modifications of part matching current location).  In the third 
form, i.e. if variables used, it's you responsibility to construct 
full valid uri.

BTW, http://$backend/$uri is actually wrong (extra '/', no query string, 
and $uri is unescaped - this sometimes matters).  Better use 
something like

    proxy_pass http://$backend$request_uri;

Maxim Dounin

More information about the nginx mailing list