Welcome! Log In Create A New Profile

Advanced

[PATCH] http_core: Do not match a file for a directory in try_files

Damien Tournoud
January 20, 2015 06:56PM
# HG changeset patch
# User Damien Tournoud <damien@commerceguys.com>
# Date 1421796392 -3600
# Wed Jan 21 00:26:32 2015 +0100
# Node ID c8f2fbe53f5df811dcaada94d3eca6c34070c610
# Parent 0a198a517eaf48baad03a76b182698c50496d380
http_core: Do not match a file for a directory in try_files.

A try_files directive with a file match (i.e. something
not ending with a "/") does not match a directory of
the same name.

But a try_files directive with a directory match like this:

try_files $uri/ =404;

.... does currently match a *file* of the same name.

This doesn't break any test, so I assume this is not the
expected behavior. I have a separate changeset to extend
the test coverage.

This makes it impossible to target generic locations for
index-expansion only like this "allow only html files,
but perform index expansion":

location / {
try_files $uri/ =404;
index index.html;
}
location ~ "\.html$" {
}

diff -r 0a198a517eaf -r c8f2fbe53f5d src/http/ngx_http_core_module.c
--- a/src/http/ngx_http_core_module.c Wed Jan 14 09:03:35 2015 +0300
+++ b/src/http/ngx_http_core_module.c Wed Jan 21 00:26:32 2015 +0100
@@ -1353,7 +1353,7 @@
continue;
}

- if (of.is_dir && !test_dir) {
+ if (of.is_dir != test_dir) {
continue;
}


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] http_core: Do not match a file for a directory in try_files

Damien Tournoud 790 January 20, 2015 06:56PM

Re: [PATCH] http_core: Do not match a file for a directory in try_files

Sergey Kandaurov 381 January 21, 2015 11:22AM

Re: [PATCH] http_core: Do not match a file for a directory in try_files

Damien Tournoud 281 February 04, 2015 10:36AM

Re: [PATCH] http_core: Do not match a file for a directory in try_files

Sergey Kandaurov 290 February 05, 2015 05:18AM

Re: [PATCH] http_core: Do not match a file for a directory in try_files

Sergey Kandaurov 293 February 06, 2015 08:52AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 107
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready