Welcome! Log In Create A New Profile

Advanced

redirect loop with try_files

May 04, 2013 10:20AM
Hi,

I have a front end nginx webserver with behind it a tomcat server. I ran into a nasty little redirect loop issue that I still don't understand. I'm trying to redirect users who have a session cookie to a different page than the other users

I have a configuration such as this:

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

map $cookie_msa_country $ctry {
default 0;
NL "nederland/NL_";
BR "brasil/BR_";
}

map $cookie_msa_lng $lng {
default "nl";
nl "nl";
pt "pt";
es "es";
en "en";
}
location = / {
set $red 0;
if ($http_cookie ~* "JSESSIONID"){
set $red 1;
}
if ($ctry = 0){
set $red 0;
}
if ($red = 1){
rewrite ^(.*)$ http://$host/$ctry$lng/account/wall/;
}

try_files /notthere.html @proxy;
}


When a users types in domain www.site.com, he ends up in an endless loop. I tried various things but without luck. Any suggestions how to avoid this?
SubjectAuthorPosted

redirect loop with try_files

mschipperheynMay 04, 2013 10:20AM

Re: redirect loop with try_files

Francis DalyMay 04, 2013 04:58PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 53
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready