Strange try_files behaviour

itpp2012 nginx-forum at nginx.us
Sat Jul 12 10:23:41 UTC 2014


Hmm, more debugging, this config returns a 404 from the backend (which it
shouldn't):

try_files $uri $uri/ =404;
set $maintmode S; 
if ($remote_addr ~ "^(192.168.*.*)$") { set $maintmode L; }
if (-f $document_root/maintenance_mode.html) { set $maintmode
"${maintmode}M"; }
if ($maintmode = SM) { return 503; }

This config returns a 404 from nginx, like it should:

try_files $uri $uri/ =404;
set $maintmode S; 
# if ($remote_addr ~ "^(192.168.*.*)$") { set $maintmode L; }
if (-f $document_root/maintenance_mode.html) { set $maintmode
"${maintmode}M"; }
if ($maintmode = SM) { return 503; }


So yes it is an IF issue but to my opinion this should not happen.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,251650,251668#msg-251668



More information about the nginx mailing list