Nginx Proxy Returns Odd Results

Maxim Dounin mdounin at mdounin.ru
Wed May 23 07:56:38 UTC 2012


Hello!

On Tue, May 22, 2012 at 06:59:01PM +0100, Jonathan Matthews wrote:

> On 22 May 2012 12:18, Maxim Dounin <mdounin at mdounin.ru> wrote:
> > The problem is that you are removing request arguments in "location
> > ~ /ws/(.*)".  Use this instead:
> >
> >    location /ws/ {
> >        proxy_pass http://127.0.0.1:8080/;
> >    }
> >
> >    location / {
> >        proxy_pass http://127.0.0.1:8080/;
> >    }
> 
> Are those proxy_pass trailing slashes correct?

Yes (you may omit one in "location /", but it doesn't really 
matter).

> Don't they remove the path so that the upstream sees all requests on
> the root URI?

See http://nginx.org/r/proxy_pass:

    When passing a request to the server, part of a URI matching 
    the location is replaced by a URI specified in the proxy_pass 
    directive.

Note well: this doesn't apply if you specify proxy_pass URL using 
variables.  In this special case the URI passed is expected to be 
fully specified in proxy_pass, and this is what actually causes 
original problem as it's specified without arguments.

Maxim Dounin



More information about the nginx mailing list