Requirements: Except /v1/updload
, /v1/uinfo
, /v1/auth
, all requests except these three URIs are forwarded Go to another server for processing.
First paste a piece of code in the nginx config configuration file server:
location ~* ^/v1/(?![upload|uinfo|auth])$ {
proxy_pass http://other.domain.com;
}
I did it based on the information on the Internet, but I tried it and it didn’t meet the requirement. I don’t know if it’s because I understood something wrong and didn’t do it right, or it’s not feasible in the first place. And because it contains part of the post request, I didn’t use if rewrite. way to deal with it. So, I would like to ask, is there any way to achieve this? Could anyone who knows please give me some advice? Thank you!
巴扎黑2017-05-27 17:47:03
location ~ ^\/v1\/(upload|uinfo|auth)$ {
proxy_pass 你自己的网址;
}
location / {
proxy_pass http://other.domain.com;
}