Reputation: 6524
I try to setup nginx such that it proxies requests to multiple locations. E.g. /location1
and /location2
should both be proxied to http://localhost:8080
. I just can't figure out how to configure this without using multiple location blocks. I already tried:
location /(location1|location2) {
proxy_pass http://localhost:8080/
}
which will only give 404s. And I've also tried:
location ~ /(location1|location2) {
proxy_pass http://localhost:8080/
}
Which will thrown an error that regular expressions are not allowed with proxy pass.
Is it possible to configure this proxy without having to create multiple location blocks?
Upvotes: 5
Views: 2320
Reputation: 4575
Apparently is missing a slash and a ';'. Try this:
location ~ (/location1|/location2) {
proxy_pass http://localhost:8080;
}
Upvotes: 1