Load Balancing - How to invert the location of nginx (jump except for some links)
巴扎黑
巴扎黑 2017-05-27 17:45:03
0
1
1522

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!

巴扎黑
巴扎黑

reply all(1)
巴扎黑
location ~ ^\/v1\/(upload|uinfo|auth)$ {
    proxy_pass 你自己的网址;
}

location / {
    proxy_pass http://other.domain.com;
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!