Welcome! Log In Create A New Profile

Advanced

location block crazyness

Posted by bred 
location block crazyness
March 25, 2022 10:31AM
Hello everyone!

I'm trying to set 2 or 3 location blocks with similar paths but somethings is going extremely wrong here.

I have these blocks (ordered like this):

```
location ~* ^/something/else/(?<path>.+) {
set $backend "backend_url";
proxy_pass $backend/$path$is_args$args;
}

location ~* ^/something {
set $backend "backend_url";
proxy_pass $backend/;
}
```

The thing is that if I hit `backend_url/something/else` the second location block handles the request. If I hit `backend_url/something/else/` then the first one does.

I've tried a few configurations, even adding a third location block with the same path, excluding the last slash but without success.

I understand that the `~*` modifier makes it reads the entire file.

Could someone help me with it?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 83
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready