try_files and redirect loops
inspire22
nginx-forum at nginx.us
Mon Apr 18 19:37:06 MSD 2011
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;
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,192095,192095#msg-192095
More information about the nginx
mailing list