missing $uri when performing proxy_pass ??

Thomas Mangin thomas.mangin at exa-networks.co.uk
Fri Feb 6 12:10:23 MSK 2009

Hello Maxim,

> 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;

Thank you for the clarification and the fix, it confused the hell out  
of me :)

For some reason I expected the $request_uri to be appended if no  
path / uri was passed and I can still not see why it should be as  
otherwise nginx is sending an invalid request anyway (GET HTTP/1.0),  
so it can not break existing configuration and would make the  
behaviour more consistent and predictable.

Could you share some light on the reason for this special case please  
(if you know of one) ?


More information about the nginx mailing list