nginx 根据header转发到不同upstream

server那点事

location / {
if ($http_x_custom_header = “”) {
proxy_pass http://localhost_server;
}
if ($http_x_custom_header = “1”) {
proxy_pass http://localhost_server1;
}
if ($http_x_custom_header = “2”) {
proxy_pass http://localhost_server2;
}
}

发表于 2019.06.14