Welcome! Log In Create A New Profile

Advanced

choosing backend based on header value

Harish Sundararaj
September 03, 2012 06:58PM
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 192.168.1.30:9001 weight=25;
server 192.168.1.45:9001 weight=75;
}

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

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

I guess that should be possible?

Thanks
Harish

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

choosing backend based on header value

Harish Sundararaj September 03, 2012 06:58PM

Re: choosing backend based on header value

Alexandr Gomoliako September 03, 2012 07:20PM

Re: choosing backend based on header value

Harish Sundararaj September 03, 2012 07:30PM

Re: choosing backend based on header value

Alexandr Gomoliako September 03, 2012 07:50PM

Re: choosing backend based on header value

Harish Sundararaj September 03, 2012 08:28PM

Re: choosing backend based on header value

Harish Sundararaj September 03, 2012 07:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 143
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready