Opened 7 years ago

Closed 7 years ago

#1404 closed defect (duplicate)

try_files not working after if condition

Reported by: x2x4com@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.13.x
Keywords: Cc: 5.4.0, 20160609
uname -a: Linux Global-Proxy 4.4.0-97-generic #120-Ubuntu SMP Tue Sep 19 17:28:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.13.2
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
built with OpenSSL 1.0.2g 1 Mar 2016
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-threads

Description

location ~ /u(/.*) {

set $router $1;
set $xargs "&and=more";
#if ($args) {
# set $noting "";
#}
try_files $uri /do?r=$router$xargs;

}

works fine, but if change config to

location ~ /u(/.*) {

set $router $1;
set $xargs "&and=more";
if ($args) {

set $noting "";

}
try_files $uri /do?r=$router$xargs;

}

always return 404, check log

2017/10/26 11:30:06 [error] 27958#27958: *53301 open() "/data/www/site_default/u/aaa" failed (2: No such file or directory), client: 101.81.121.148, server: 9chain.kmdns.net, request: "GET /u/aaa?a=1 HTTP/1.1", host: "ol.dev.bidpoc.com:8000"
2017/10/26 11:30:21 [notice] 27990#27990: signal process started
2017/10/26 11:30:24 [error] 27999#27999: *53304 open() "/data/www/site_default/u/aaa" failed (2: No such file or directory), client: 101.81.121.148, server: 9chain.kmdns.net, request: "GET /u/aaa?a=1 HTTP/1.1", host: "ol.dev.bidpoc.com:8000"

Change History (1)

comment:1 by Valentin V. Bartenev, 7 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #86.

Note: See TracTickets for help on using tickets.