Opened 8 years ago
Closed 8 years ago
#1090 closed defect (fixed)
try_files with map variable works differently in 1.10.x and 1.11.x
Reported by: | Pyry Hakulinen | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-core | Version: | 1.11.x |
Keywords: | Cc: | ||
uname -a: | Linux foo.example 3.16.0-0.bpo.4-amd64 #1 SMP Debian 3.16.7-ckt2-1~bpo70+1 (2014-12-08) x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.11.4
built with OpenSSL 1.0.2i 22 Sep 2016 TLS SNI support enabled configure arguments: --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --conf-path=/usr/local/etc/nginx.conf --error-log-path=/var/log/nginx/error_log --http-log-path=/var/log/nginx/access_log --sbin-path=/usr/local/sbin/nginx --with-openssl=../openssl-1.0.2i/ --with-http_auth_request_module --with-debug --add-module=../nginx_auth_mysql-r132-1.11.x/ --add-module=../ngx_devel_kit-0.2.19/ --add-module=../lua-nginx-module-0.10.6/ |
Description
Following config:
map $uri $wordpress_uri { default $uri; # Real config contains other stuff, which doesn't match, and doesn't matter (like this): ~^(/[_0-9a-zA-Z-]+)?(?<wp_file_uri>/wp-.+)$ $wp_file_uri; } server { listen 80; index index.php index.html; root /tmp/nginx; location / { try_files $wordpress_uri $wordpress_uri/ @fallback; } location @fallback { return 200 "ok"; } }
/tmp/nginx/index.html
Somefile
On 1.11.x this will result in internal redirect loop:
2016/09/30 07:36:46 [error] 27355#0: *9 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 10.10.10.10, server: _, request: "GET / HTTP/1.1", host: "somehost.example.com"
On 1.10.x it will work fine and the contents of /tmp/nginx/index.html is returned to the client. Also if I change try_files to try_files $uri $uri/ @fallback; it will work fine in both versions.
Attached are debug logs for both 1.10.1 and 1.11.4.
Is this intentional change of behavior or a bug? Also if it's intentional, it would be helpful if changes like this were mentioned in the Changelog. Thanks and happy to provide more information if needed.
Attachments (2)
Change History (5)
by , 8 years ago
Attachment: | nginx-1.10.1-debug-log added |
---|
by , 8 years ago
Attachment: | nginx-1.11.4-debug-log added |
---|
comment:1 by , 8 years ago
comment:3 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Closing this. The "volatile" parameter was introduced to facilitate configurations which need non-cacheable map{} results. See the commit log above for details.
Our builds have lua (and other custom modules), but the internal redirect loop also happens with vanilla builds.