summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules/ngx_http_upstream_sticky_module.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2026-03-09Sticky: fixed expiration of learned sessions after reload.Aleksei Bavshin1-2/+57
Previously, the expiration timer for learned session was not started until a new session is created. This could lead to the sessions being active past the expiration time.
2026-03-09Sticky: samesite=<strict|lax|none> cookie flags.Vladimir Kokshenev1-1/+89
Adds new options for the "sticky cookie" directive to set samesite=<strict|lax|none> cookie flags.
2026-03-09Sticky: added the "header" parameter in the learn mode.Vladimir Homutov1-15/+57
With this parameter set, sessions are learned after receiving upstream headers.
2026-03-09Sticky: added the "max-age" attribute to cookie.Vladimir Homutov1-4/+6
RFC 6265 defines "Max-Age" cookie attribute in section 5.2.2. If the "expires" option is passed to the "sticky" directive, "max-age" attribute will appear in cookies set by the module with corresponding value in seconds. For the special "max" value of the "expires" option, corresponding "max-age" attribute value will be set to 315360000 seconds (10 years, similar to how its done in headers_filter module for the "Cache-Control" header).
2026-03-09Sticky: added variables support to cookie domain.Vladimir Homutov1-18/+38
2026-03-09Sticky: added "httponly" and "secure" attributes.Vladimir Homutov1-0/+39
The attributes are described in RFC6265, sections 4.1.2.5 and 4.1.2.6 respectively.
2026-03-09Sticky: added the "learn" mode.Vladimir Homutov1-92/+767
In this mode, nginx "learns" which client uses which proxied server by analyzing headers of client requests and proxied server responses. For example, a proxied server may start sessions by issuing the "Set-Cookie" header field to set cookie 'sid' and returning clients will bring the cookie with the same name. The following configuration may be used to handle this case: upstream u1 { server 127.0.0.1:8080; server 127.0.0.1:8081; sticky learn timeout=10m zone=sess:1m create=$upstream_cookie_sid lookup=$cookie_sid; } Co-authored-by: Ruslan Ermilov <ru@nginx.com> Co-authored-by: Maxim Dounin <mdounin@mdounin.ru>
2026-03-09Upstream: added sticky sessions support for upstreams.Vladimir Homutov1-0/+592
Sticky sessions allow to route the same client to the same upstream server. - upstream structures are extended to keep session-related information - existing balancing modules are updated to provide an id of the selected server (SID) in pc->sid, and to select the server, given it's SID. - other balancing modules are allowed to set the pc->hint value to choose the desired peer. The sticky module will not change the hint if it's already set. - the feature is enabled by default and can be disabled with the "--without-http_upstream_sticky" switch of the configure script. The following configuration can be used to enable sticky sessions for supported balancing modules: upstream u1 { server 127.0.0.1:8080; server 127.0.0.1:8081; sticky cookie server_id expires=1h domain=.example.com path=/; } Co-authored-by: Ruslan Ermilov <ru@nginx.com> Co-authored-by: Roman Arutyunyan <arut@nginx.com> Co-authored-by: Maxim Dounin <mdounin@mdounin.ru>