Welcome! Log In Create A New Profile

Advanced

Upstream hash by multiple criteria

Kamil Gorlo
July 12, 2011 03:24AM
Hello,

I am using ngx_http_upstream_hash_module for balancing requests to backend,
is there any way to balance by two or more variables, not one?

I want to write something like this:

upstream backend {
hash $http_x_user $arg_user;
server some_backend_1:8080;
server some_backend_2:8080;
}

Semnatics is as follows:
- if there is x-user header in request use it to calculate hash and
go to backend connected with calculated hash
- it there is no x-user header look at query string, if there is user
field in query string calculate hash based on it

Is it possible? Or maybe it is easier with
ngx_http_upstream_consistent_hash (which even will be preferable)?

Cheers,

--
Kamil Gorlo

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

Upstream hash by multiple criteria

Kamil Gorlo July 12, 2011 03:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 279
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