<div dir="ltr"><div><div><div>Hi!<br></div><br></div>We experience problem: if inside location we use geoip variable try_files is not working and only root location is looked up for files.<br><br></div>So problem is reproducible with the following virtual server configuration (full configuration in attachment):<br><div><div><br>==================<br>geo $dontsecure {<br>    default 0;<br>    <a href="http://172.16.11.0/24">172.16.11.0/24</a> 1;<br>    <a href="http://127.0.0.0/24">127.0.0.0/24</a> 1;<br>}<br><br>server {<br>    listen 172.16.11.31 default_server;<br>    listen 127.0.0.1 default_server;<br><br>    access_log  /var/log/nginx/production-dvr.access_log main;<br>    error_log  /var/log/nginx/production-dvr.error_log  debug;<br><br>    location ~ /([^/]*?)(_lang_[0-9])?/.*\.ts {<br><b>        if ($dontsecure) {<br>            set $reject_access 0;<br>        }</b><br><br>         root /tmp/test/;<br>         try_files /dir1$uri /dir2$uri =404;<br>    }<br>}<br>==================<br><br></div><div>/tmp/test has follofing files: <br></div><div>/tmp/test/dir2/test/1.ts - file<br>/tmp/test/dir1/test - directory<br><br></div><div>Now if we request <a href="http://172.16.11.31/test/1.ts">http://172.16.11.31/test/1.ts</a> nginx returns 404 until I comment out selected by bold font lines. In debug log (debug-log-nginx.txt in attachment) it's clear that try_files directive is doing nothing and only /tmp/test/test/1.ts is looked up.<br><br></div><div>Now if I comment out this three bold lines in nginx works as expected and looks up /tmp/test/dir1/test/1.ts or if it not exist  /tmp/test/dir2/test/1.ts file.<br><br>nginx version: nginx/1.7.11<br>TLS SNI support enabled<br>configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error_log --pid-path=/run/nginx.pid --lock-path=/run/lock/nginx.lock --with-cc-opt=-I/usr/include --with-ld-opt=-L/usr/lib64 --http-log-path=/var/log/nginx/access_log --http-client-body-temp-path=/var/lib/nginx/tmp/client --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --with-debug --with-ipv6 --with-pcre --with-http_flv_module --with-http_geoip_module --with-http_mp4_module --with-http_secure_link_module --with-http_realip_module --add-module=external_module/nginx-rtmp-module-1.1.7 --add-module=external_module/nginx-push-stream-module-0.4.1 --with-http_ssl_module --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --user=nginx --group=nginx<br><div><div><div><br><br><div><div class="gmail_signature">--<br>Peter.</div></div>
</div></div></div></div></div></div>