Issue
Can location directive resolve the incoming requests not at the beginning, but anywhere in the middle of the URI.
for example i have to match location based on environment.
location /uat/ {.....}
location /sit/ {.....}
The request coming in would be /abc/customer/uat/ide
How to make a match when the environment name is not in the beginning of the URI.
Thanks in advance.
Solution
You can have something like this
server {
listen ...;
server_name _;
location ~* .*/sit/.*$ {
...
}
location ~* .*/uat/.* {
...
}
}
Breakdown of regex ~* .*/uat/.*
:
~*
-> Makes the matching case insensitive.*
-> Any character any number of times/uat/
-> Match /uat/.*
-> Any character any number of times
Answered By - NetanMangal Answer Checked By - Pedro (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.