On Sat, May 04, 2013 at 10:20:32AM -0400, mschipperheyn wrote:

Hi there,

> ## Rewrite index requests
> rewrite ^(.*)/index.(.*)$ $1/ permanent;

That is likely to lead to a loop, unless you take great care elsewhere.

(The typical defaults are: a request for /dir/ leads to an internal
rewrite to /dir/index.html, which the above would convert to an external
redirect to /dir/, which is where we came in.)

> location = / {
>          set $red  0;
>          if ($http_cookie ~* "JSESSIONID"){
>                          set $red 1;
>          }

Here, you use "if" inside "location" and you do something other than
"return" or "rewrite ... last". That's rarely a good idea:

http://wiki.nginx.org/IfIsEvil

Can you move the if/set logic to server{} level, to avoid that likely
confusion?

> When a users types in domain www.site.com, he ends up in an endless loop.

I strongly suspect that the loop is caused by the first rewrite, because
the try_files does not apply because at least one of your "if" conditions
is true.

You can test that by trying "curl -i http://www.site.com/";, and adding
whatever is necessary to make sure that none of the "if" conditions match,
and seeing if you get anything different.

Or you can just redo the configuration to avoid most "if" inside
"location" blocks.

        f
-- 
Francis Daly        fran...@daoine.org

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

Reply via email to