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

NameTypeDescription
namecookie nameCookie-form identifier, following literal cookie. This entry is scoped to the cookie form.
expiresexpires=duration|maxLifetime; omitted gives session cookie.
domaindomain=domain expressionDomain scope; omit for host-only behavior.
httponlyliteral httponlyPrevent script access to routing cookie.
samesitesamesite=strict|lax|none|expressionCross-site cookie policy.
secureliteral secureRestrict browser transmission to secure connections.
pathpath=pathPath scope.

Working Example

Example Snippetnginx
sticky cookie lab_route;
Nginx Reference