mirror of
https://github.com/nginx/nginx.git
synced 2026-11-02 09:00:15 -06:00
Upstream: added sticky sessions support for upstreams.
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>
This commit is contained in:
1 parent
dff46cd1ae
commit
104734f218
13 files changed
+1028
-9
No files matched your search
@@ -950,6 +950,20 @@ if [ $HTTP = YES ]; then
|
||||
. auto/module
|
||||
fi
|
||||
|
||||
if [ $HTTP_UPSTREAM_STICKY = YES ]; then
|
||||
have=NGX_HTTP_UPSTREAM_STICKY . auto/have
|
||||
have=NGX_HTTP_UPSTREAM_SID . auto/have
|
||||
|
||||
ngx_module_name=ngx_http_upstream_sticky_module
|
||||
ngx_module_incs=
|
||||
ngx_module_deps=
|
||||
ngx_module_srcs=src/http/modules/ngx_http_upstream_sticky_module.c
|
||||
ngx_module_libs=
|
||||
ngx_module_link=$HTTP_UPSTREAM_STICKY
|
||||
|
||||
. auto/module
|
||||
fi
|
||||
|
||||
if [ $HTTP_STUB_STATUS = YES ]; then
|
||||
have=NGX_STAT_STUB . auto/have
|
||||
|
||||
|
||||
Reference in new issue
Block a user