Answer the question
In order to leave comments, you need to log in
How to compose location for proxy_pass with regular expression?
I need to proxy all requests like host/some/server/ to another ip.
some can be anything.
There can be both get with arguments and POST with a body.
The problem is that when I do this
location ^~/some/server/ {
proxy_pass http://192.168.81.71;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location ~^/(some1|some2)/server/(.*) {
proxy_pass http://000.000.000.000/$1/server/$2?$args;
Answer the question
In order to leave comments, you need to log in
Actually, the problem was resolved in a banal way.
location ~^/(.*)/server/ {
proxy_pass http://host;
Worked great.
The problem was ok location.
I moved it to the beginning of the config and everything worked.
Thanks
Do you have a bug?
In a working config
Versus
In that where does not work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question