]> git.kaiwu.me - nginx.git/commit
Sticky: added the "learn" mode.
authorVladimir Homutov <vl@nginx.com>
Mon, 5 May 2014 07:53:10 +0000 (11:53 +0400)
committerAleksei Bavshin <a.bavshin@f5.com>
Mon, 9 Mar 2026 17:08:30 +0000 (11:08 -0600)
commitaf7137c88a87d4592d8d5879adf50b151d61e5b6
tree921c1a296cbba4498aab7363c546e868ae7844c7
parent104734f21888cfec6994e092073f51a0d4b0fb47
Sticky: added the "learn" mode.

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>
src/http/modules/ngx_http_upstream_sticky_module.c