Nginx proxy_pass基于POST/GET/PUT/DELETE参数

Ped*_*ran 11 reverse-proxy nginx

我正在尝试配置nginx以proxy_pass根据我的请求中的POST/GET/PUT/DELETE参数执行操作.

我想proxy_pass,以http://10.0.0.2:8000是否live=1http://10.0.0.2:8081是否live=0.

我试过使用if ($arg_live = "1")但它只适用于GET请求.

谢谢,

佩德罗

yas*_*ash 0

我建议你试试这个..

if ($request_method = 'POST') {
 #your_directives_here
}
Run Code Online (Sandbox Code Playgroud)