Nginx as reverse proxy for Jetty

Maxim Dounin mdounin at mdounin.ru
Wed Nov 24 13:37:36 MSK 2010


Hello!

On Wed, Nov 24, 2010 at 09:05:35AM +0100, Martin wrote:

> Okay,
> 
> here it is.
> 
> Martin
> 
> Attachments:
> http://www.ruby-forum.com/attachment/5445/bigserver.conf

This location:

        # bigserver.cz/username -> profile.bigserver.cz/username/profile/
        location / {
            rewrite ^/([^/]+) http://profile.bigserver.cz/$1/profile/ redirect;
        }

matches requests to "/" exactly and stopped matching.  But it 
doesn't redirect "/" itself.  Without index set this 
obviously results in 403.

One simple solution is to define exact location = /, i.e.

    location = / {
        ...
    }

with appropriate proxy_pass'es.

In 0.8.42 behaviour has been changed to be a bit more 
intuitive:

    *) Change: now nginx tests locations given by regular expressions, if 
       request was matched exactly by a location given by a prefix string. 
       The previous behavior has been introduced in 0.7.1.

and your location / no longer prevents your regexp location with 
proxy_pass from working.  That's why you don't see "problem" in 
0.8.53.

Maxim Dounin



More information about the nginx mailing list