choosing backend based on header value

Harish Sundararaj tuxtoti at
Mon Sep 3 22:56:23 UTC 2012

Hi All,

I have a requirement wherein I need to choose a backend based on the
value of a header sent by the client. But in all other cases where the
header is not set I would like to use the available upstream block
with whatever logic (wr/r) it is set to.

For eg:

upstream backend_boxes {
server weight=25;
server weight=75;

locatinon ~ ^/test {
proxy_pass http://backend_boxes;

But, say If X-Caching-Node is set to , I want the
/test request to go to

I guess that should be possible?


More information about the nginx mailing list