Changes between Version 2 and Version 3 of Ticket #2334


Ignore:
Timestamp:
03/15/22 15:06:18 (3 years ago)
Author:
Maxim Dounin
Comment:

Both location blocks provided works fine here.

Note though that using numbered captures is error prone, because numbered captures are used from the last regular expression executed. For example, adding any rewrite directive to the first location block will break things, as the rewrite directive will use regular expressions, overwriting the $1 .. $9 variables. The fact that the second location block works for you when the first one doesn't likely indicate that this is exactly what happens in your case.

To further confirm what exactly breaks in your case, please provide full (yet minimal) nginx configuration which is not working. Output of nginx -T would be optimal.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2334 – Description

    v2 v3  
    11with the following rule:
    2 
     2{{{
    33        location ~*  ^/([^/]+)\/? {
    44                root /usr/share/nginx/html/;
     
    66                try_files $uri $uri/ /$1/index.html;
    77        }
    8 
     8}}}
    99when access with http://mytest.server.com/myproject/browser/route/
    1010path /browser/route/ does not exist which expected to to use /myproject/index.html
     
    3434
    3535the following rule works on the server nginx 1.20.0
    36 
     36{{{
    3737location ~*  ^/(?<prefix>[^/]+)\/? {
    3838                root /usr/share/nginx/html;
     
    4040                try_files $uri $uri/ /$prefix/index.html;
    4141        }
     42}}}
    4243
    43