Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个上游命名frontendcluster,admincluster我想这样做:
frontendcluster
admincluster
如果请求 uri 包含/adminor/upload或请求方法,POST则使用 admincluster。否则代理传递给前端集群。
/admin
/upload
POST
我怎样才能在我的 conf 文件中做到这一点?
您可以在 nginx 中执行此操作,例如...
location /admin { proxy_pass http://backend; } location /upload { proxy_pass http://backend; } if ($request_method = POST) { proxy_pass http://backend; }