[PATCH] HTTP upstream: added possibility to specify variables for the ip_hash directive

Roman Arutyunyan arut at nginx.com
Thu May 22 07:45:06 UTC 2014


On 22 May 2014, at 11:32, Alexey K. <alexeyk45 at gmail.com> wrote:

> # HG changeset patch
> # User Alexey K. <alexeyk45 at gmail.com>
> # Date 1400743228 -21600
> #      Thu May 22 13:20:28 2014 +0600
> # Node ID cbfb9bc7dc93c10baaa80571665ca1231afdafe9
> # Parent  d5b8ee9f2201e1d9fa7ac41da9a4a8d939cd42b1
> HTTP upstream: added possibility to specify variables for the ip_hash directive.
> 
> Example: ip_hash $http_x_forwarded_for;
> By default, without any parameters, client's IP address is used.
> 
> A use case:
> A group of load balancers is put behind another group. Thus client's IP address for the former is always one of the latter's.
> With this patch ip_hash can use any variable with a valid address, including the one in X-Forwarded-For header.

It’s better to support a complex value (expression) than just a single variable
A hash balancer with this feature is planned for future nginx versions.


More information about the nginx-devel mailing list