nginx load balance upstream hash using custom header

Viewed 123

We can create an upstream block using a hash of $request_uri as below

upstream backend {
    hash $request_uri consistent;
    server backend1.example.com;
    server backend2.example.com;
}

Can we use a custom header for this hash instead of request_uri?

0 Answers
Related