[PATCH] Allowed nesting arbitrary prefix "location" in regex "location"

Valentin V. Bartenev vbart at wbsrv.ru
Mon Sep 4 19:11:47 UTC 2023


# HG changeset patch
# User Valentin Bartenev <vbart at wbsrv.ru>
# Date 1693854233 -10800
#      Mon Sep 04 22:03:53 2023 +0300
# Node ID c706913db63c6862c13a0a540cdc37be0ccf0c81
# Parent  daf8f5ba23d8e9955b22782d945f9c065f4b6baa
Allowed nesting arbitrary prefix "location" in regex "location".

Previously, only prefix "location" blocks that literally matched the beginning
of the regular expression were allowed inside.  This restriction makes no sense
because regular expressions have different matching semantics.

diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -3202,6 +3202,7 @@ ngx_http_core_location(ngx_conf_t *cf, n
 
 #if (NGX_PCRE)
         if (clcf->regex == NULL
+            && pclcf->regex == NULL
             && ngx_filename_cmp(clcf->name.data, pclcf->name.data, len) != 0)
 #else
         if (ngx_filename_cmp(clcf->name.data, pclcf->name.data, len) != 0)


More information about the nginx-devel mailing list