HTTP upstream directives
sticky directive (HTTP upstream)
HTTP upstream context. Cookie form shown; route and learn variants exist. OSS from 1.29.6; sync remains commercial. Not a session store.
Formal Syntax & Structure
nginx syntaxnginx
sticky cookie name [parameters];Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | cookie name | Cookie-form identifier, following literal cookie. This entry is scoped to the cookie form. |
| expires | expires=duration|max | Lifetime; omitted gives session cookie. |
| domain | domain=domain expression | Domain scope; omit for host-only behavior. |
| httponly | literal httponly | Prevent script access to routing cookie. |
| samesite | samesite=strict|lax|none|expression | Cross-site cookie policy. |
| secure | literal secure | Restrict browser transmission to secure connections. |
| path | path=path | Path scope. |
Working Example
Example Snippetnginx
sticky cookie lab_route;