[PATCH 4 of 7] Tests: additional try_files test with nested prefix location
Maxim Dounin
mdounin at mdounin.ru
Fri Apr 17 22:50:23 UTC 2026
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1776466173 -10800
# Sat Apr 18 01:49:33 2026 +0300
# Node ID 6ea4efddc9a36f034e3a8420414a52daac62004e
# Parent 1b0215d2bf862ceabc938de20e9e65d025d39a3d
Tests: additional try_files test with nested prefix location.
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