Welcome! Log In Create A New Profile


redirect loop with try_files

May 04, 2013 10:20AM

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?
Subject Author Posted

redirect loop with try_files

mschipperheyn May 04, 2013 10:20AM

Re: redirect loop with try_files

Francis Daly May 04, 2013 04:58PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 302
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