Reputation: 353
I want to use one location directive nginx as a
/auth/
Example:-
location = /auth/v1/registration
{
proxy_pass http://backend1/auth/v1/registration;
}
In this example i want that like if i provide anything before /auth/ and after /auth/ is taken by default it only match only auth
location = *****/auth/*******
{
proxy_pass http://backend1/auth/v1/registration;
}
what can i replace with ***** Thankyou in advance...
Upvotes: 0
Views: 835
Reputation: 317
The regular expressions used by nginx are compatible with those used by the Perl programming language (PCRE).
Try it:
location ~* ^.*/auth/.*$ { ... }
Tests:
# pcretest
PCRE version 8.39 2016-06-14
re> ~^.*/auth/.*$~i
data> /some/auth/text
0: /some/auth/text
data> /some/text
No match
data> /auth/text
0: /auth/text
data> /some/auth/
0: /some/auth/
data> /some/auth2
No match
Upvotes: 1