[nginx-tests] Tests: additional try_files test with nested prefi...

Maxim Dounin mdounin at mdounin.ru
Sat Apr 25 05:48:22 UTC 2026


details:   http://freenginx.org/hg/nginx-tests/rev/6ea4efddc9a3
branches:  
changeset: 2050:6ea4efddc9a3
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Sat Apr 18 01:49:33 2026 +0300
description:
Tests: additional try_files test with nested prefix location.

diffstat:

 http_try_files.t |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (38 lines):

diff --git a/http_try_files.t b/http_try_files.t
--- a/http_try_files.t
+++ b/http_try_files.t
@@ -21,7 +21,7 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(17)
+my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(18)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -91,9 +91,14 @@ http {
 
         location /alias-nested/ {
             alias %%TESTDIR%%/;
+
             location ~ html {
                 try_files $uri =404;
             }
+
+            location /alias-nested/prefix {
+                try_files /found.html =404;
+            }
         }
 
         location /alias-static/ {
@@ -169,7 +174,9 @@ like(http_get('/alias-re-prefix/found'),
 }
 
 like(http_get('/alias-nested/found.html'), qr!SEE THIS!,
-	'alias with nested location');
+	'alias with nested regex location');
+like(http_get('/alias-nested/prefix'), qr!SEE THIS!,
+	'alias with nested prefix location');
 
 # when a file matches location prefix covered by alias,
 # prefix needs to be removed; this used to work only with


More information about the nginx-devel mailing list