Welcome! Log In Create A New Profile

Advanced

try_files and redirect loops

April 18, 2011 11:37AM
Hi all!

I need to make sure try_files does not send to a static file if $args are included.

#if ($args != "") {rewrite ^ @ app;} # tried here and below.

location = / { rewrite ^ /home/index/$host; }
location / {
if ($args = "") { rewrite ^ @app;}
try_files /downtime.html $uri/index.html $uri @app;# double rewrite error
}

location @app {
proxy_pass http://app_server;
...

I also tried something like this, but "break" makes it not match the location @app either.

Thanks for any help you can give me, my forehead is sore from pounding it against the keyboard :)
-Kevin

location / {
# reload=auto refreshes cached content. hmm, easy to have this match twice which causes problems!
if ($http_cache_control ~* "no-cache") { rewrite ^ $uri?recache; }
if ($args != "") {rewrite ^ @app;}

location = / { rewrite ^ /home/index/$host; }
location ~* /$ { rewrite ^ $uri/index.html; }

# after break won't match any location rules either :(
if (!-f $uri) {rewrite ^ @app; break;}
}

location @app {
proxy_pass http://app_server;
Subject Author Posted

try_files and redirect loops

inspire22 April 18, 2011 11:37AM

Re: try_files and redirect loops

Francis Daly April 18, 2011 12:32PM

Re: try_files and redirect loops

inspire22 April 18, 2011 01:50PM

Re: try_files and redirect loops

Francis Daly April 18, 2011 02:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 184
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready