Welcome! Log In Create A New Profile

Advanced

preventing rewrite loops with "index"

Dennis J.
January 22, 2010 09:14AM
Hi,
So with my first rewrite issue solved I now move closer towards the real
configuration and run into a problem with the index directive.

My location looks like this:

location ~* ^/(([A-Za-z])([A-Za-z0-9])([A-Za-z0-9])[^/]*)(/.*)?$ {
root /web;
set $site_path /users/$2/$3/$4/$1/htdocs;
set $real_uri $5;
rewrite .* $site_path$real_uri break;
}

When I request "/test/index.html" the location matches and gets properly
rewritten into a hashed form "/users/t/e/s/test/index.html". Then the root
get prefixed resulting in the path "/web/users/t/e/s/test/index.html" which
get correctly delivered by nginx. So far so good.

The problem happens when I request "/test/" instead which should deliver
the same index.html through the index directive. That doesn't happen though.

Looking at the log what seems to happen is that nginx sees that
"/web/users/t/e/s/test/" is a directory and issues a new request with the
uri "/web/users/t/e/s/test/index.html". This however matches the above
location again resulting in another rewrite that ends with a completely
broken path and a 404.

How can I get that the correct index processing for the first correctly
rewritten path without triggering another round of location processing
messing things up?

Regards,
Dennis

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

preventing rewrite loops with "index"

Dennis J. January 22, 2010 09:14AM

Re: preventing rewrite loops with "index"

Igor Sysoev January 22, 2010 10:06AM

Re: preventing rewrite loops with "index"

Dennis J. January 22, 2010 08:50PM

Re: preventing rewrite loops with "index"

Maxim Dounin January 22, 2010 11:02PM

Re: preventing rewrite loops with "index"

Dennis J. January 22, 2010 11:22PM

Re: preventing rewrite loops with "index"

Maxim Dounin January 23, 2010 12:56AM

Re: preventing rewrite loops with "index"

Piotr Sikora January 24, 2010 04:50PM

Re: preventing rewrite loops with "index"

Maxim Dounin January 24, 2010 06:16PM

Re: preventing rewrite loops with "index"

Eugaia January 25, 2010 02:02AM

Re: preventing rewrite loops with "index"

Maxim Dounin January 25, 2010 06:04AM

Re: preventing rewrite loops with "index"

Eugaia January 25, 2010 06:34AM

Re: preventing rewrite loops with "index"

Dennis J. January 25, 2010 08:04AM

Re: preventing rewrite loops with "index"

Dennis J. January 27, 2010 10:22PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 108
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready