upstream upstream1{
}
upstream upstream2{
}
upstream upstream3{
}
upstream upstream4{
}
request url is XXXX
if (id is 1~100 key=key1) send to upstream1
if (id is 1~100 key=key2) send to upstream2
if (id is 101~200 key=key1) send to upstream3
if (id is 101~200 key=key2 ) send to upstream4
jqzone
March 22, 2014, 7:33am
2
Hello,
How to proxy request to different upstream by url request parameters?
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#sticky
Cheers,
Thomas
jqzone
March 22, 2014, 7:40am
3
Hello,
How to proxy request to different upstream by url request parameters?
Module ngx_http_upstream_module
this is part of the commercial subscription, but you can probably obtain
the same using a MAP like that:
map $arg_key $backend {
key1 backend1;
key2 backend2;
default fail;
}
proxy_pass http://$arg_key;
Cheers,
Thomas