HTTP upstream directives
hash directive (HTTP upstream)
HTTP upstream context; since 1.7.2. Selects a peer using a key; consistent mode limits key redistribution on membership changes.
Formal Syntax & Structure
nginx syntaxnginx
hash key [consistent];Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | expression | Select the value used for peer hashing. |
| consistent | literal consistent | Use consistent hashing to reduce remapping after peer changes. |
Working Example
Example Snippetnginx
hash $uri consistent;