The release of the main branch nginx 1.29.6 has been published, continuing the development of new features. In the concurrently supported stable branch 1.28.x, only changes related to fixing serious bugs and vulnerabilities are made. In the future, a stable branch 1.30 will be formed based on the main branch 1.29.x. The project code is written in C and is distributed under the BSD license.
The new release adds the ability to bind client sessions to the same servers in a group. Three methods are available: "cookie" — passing session data through the specified Cookie; "route" — the proxy server assigns a route to the client upon receiving the first request; "learn" — nginx analyzes responses from the upstream server and remembers sessions initiated by the server. server To configure the binding, a directive "sticky" is added to the "upstream" block of the "http" module, and the parameters "route" and "drain" are added to the "server" directive. # Through Cookie srv_id, the server is set to "a" or "b". upstream backend { server backend1.example.com route=a; server backend2.example.com route=b; sticky cookie srv_id expires=1h domain=.example.com path=\/; } # The route is taken from Cookie "JSESSIONID" or, if it is not set, from the jsessionid parameter in the URI. map $cookie_jsessionid $route_cookie { ~.+\.(?P\w+)$ $route; } map $request_uri $route_uri { ~jsessionid=.+\.(?P\w+)$ $route; } upstream backend { server backend1.example.com route=a; server backend2.example.com route=b; sticky route $route_cookie $route_uri; } # The upstream server creates a session by setting the Cookie "EXAMPLECOOKIE" upon the first response. # Subsequent requests with this Cookie are sent to one server. upstream backend { server backend1.example.com:8080; server backend2.example.com:8081; sticky learn create=$upstream_cookie_examplecookie lookup=$cookie_examplecookie zone=client_sessions:1m; }
Source: opennet.ru
