How to proxy request to different upstream by url request parameters

upstream upstream1{

}

upstream upstream2{

}

upstream upstream3{

}

upstream upstream4{

}

request url is http://xxxx.com/id=xxx&key=xxx

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

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

Hello,

How to proxy request to different upstream by url request parameters?

http://nginx.org/en/docs/http/ngx_http_upstream_module.html#sticky

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

Thanks,it works well!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs