<feed xmlns='http://www.w3.org/2005/Atom'>
<title>nginx.git/src/http/ngx_http_upstream.c, branch release-1.29.7</title>
<subtitle>nginx</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/'/>
<entry>
<title>Sticky: added the "header" parameter in the learn mode.</title>
<updated>2026-03-09T17:08:30+00:00</updated>
<author>
<name>Vladimir Homutov</name>
<email>vl@nginx.com</email>
</author>
<published>2017-06-08T12:39:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=8021cb02de840d6168a98e4eefb9bdfbe51ba96e'/>
<id>8021cb02de840d6168a98e4eefb9bdfbe51ba96e</id>
<content type='text'>
With this parameter set, sessions are learned after receiving upstream headers.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With this parameter set, sessions are learned after receiving upstream headers.
</pre>
</div>
</content>
</entry>
<entry>
<title>Sticky: added "draining" peer state.</title>
<updated>2026-03-09T17:08:30+00:00</updated>
<author>
<name>Vladimir Homutov</name>
<email>vl@nginx.com</email>
</author>
<published>2014-08-28T07:53:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=d12dd2405d659707f75eaa93d45ed762cc5bdd5d'/>
<id>d12dd2405d659707f75eaa93d45ed762cc5bdd5d</id>
<content type='text'>
While peer is draining, only sticky requests are served and the peer is never
selected to process new requests.

Co-authored-by: Ruslan Ermilov &lt;ru@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While peer is draining, only sticky requests are served and the peer is never
selected to process new requests.

Co-authored-by: Ruslan Ermilov &lt;ru@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Upstream: introduced a new macro for down value.</title>
<updated>2026-03-09T17:08:30+00:00</updated>
<author>
<name>Aleksei Bavshin</name>
<email>a.bavshin@nginx.com</email>
</author>
<published>2026-03-04T19:35:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=c5036ad30cfafb233494fa81c0b328aac3eb0e9b'/>
<id>c5036ad30cfafb233494fa81c0b328aac3eb0e9b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Upstream: added sticky sessions support for upstreams.</title>
<updated>2026-03-09T17:08:30+00:00</updated>
<author>
<name>Vladimir Homutov</name>
<email>vl@nginx.com</email>
</author>
<published>2013-04-02T21:44:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=104734f21888cfec6994e092073f51a0d4b0fb47'/>
<id>104734f21888cfec6994e092073f51a0d4b0fb47</id>
<content type='text'>
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-&gt;sid, and to select the server, given it's SID.

- other balancing modules are allowed to set the pc-&gt;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 &lt;ru@nginx.com&gt;
Co-authored-by: Roman Arutyunyan &lt;arut@nginx.com&gt;
Co-authored-by: Maxim Dounin &lt;mdounin@mdounin.ru&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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-&gt;sid, and to select the server, given it's SID.

- other balancing modules are allowed to set the pc-&gt;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 &lt;ru@nginx.com&gt;
Co-authored-by: Roman Arutyunyan &lt;arut@nginx.com&gt;
Co-authored-by: Maxim Dounin &lt;mdounin@mdounin.ru&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Upstream: reinit upstream after reading bad response.</title>
<updated>2026-02-04T15:09:20+00:00</updated>
<author>
<name>Roman Arutyunyan</name>
<email>arut@nginx.com</email>
</author>
<published>2026-01-28T16:38:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=d7a249470b78a155c7548aea5f4eb959dae9fd03'/>
<id>d7a249470b78a155c7548aea5f4eb959dae9fd03</id>
<content type='text'>
Previously, when connecting to a backend, if the read event handler was
called before the write event handler, and the received response triggered
a next upstream condition, then ngx_http_upstream_reinit() was not called
to clean up the old upstream context.  This had multiple implications.

For all proxy modules, since the last upstream response was not cleaned up,
it was mixed with the next upstream response.  This could result in ignoring
the second response status code, duplicate response headers or reporting
old upstream header errors.

With ngx_http_grpc_module and ngx_http_proxy_v2_module, ctx-&gt;connection
was left dangling since the object it referenced was allocated from the
last upstream connection pool, which was deleted when freeing last upstream.
This lead to use-after-free when trying to reuse this object for the next
upstream.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, when connecting to a backend, if the read event handler was
called before the write event handler, and the received response triggered
a next upstream condition, then ngx_http_upstream_reinit() was not called
to clean up the old upstream context.  This had multiple implications.

For all proxy modules, since the last upstream response was not cleaned up,
it was mixed with the next upstream response.  This could result in ignoring
the second response status code, duplicate response headers or reporting
old upstream header errors.

With ngx_http_grpc_module and ngx_http_proxy_v2_module, ctx-&gt;connection
was left dangling since the object it referenced was allocated from the
last upstream connection pool, which was deleted when freeing last upstream.
This lead to use-after-free when trying to reuse this object for the next
upstream.
</pre>
</div>
</content>
</entry>
<entry>
<title>Upstream: detect premature plain text response from SSL backend.</title>
<updated>2026-02-04T15:09:20+00:00</updated>
<author>
<name>Roman Arutyunyan</name>
<email>arut@nginx.com</email>
</author>
<published>2026-01-29T09:27:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=a59f5f099a89dc8eaebd48077292313f9f7e33e3'/>
<id>a59f5f099a89dc8eaebd48077292313f9f7e33e3</id>
<content type='text'>
When connecting to a backend, the connection write event is triggered
first in most cases.  However if a response arrives quickly enough, both
read and write events can be triggered together within the same event loop
iteration.  In this case the read event handler is called first and the
write event handler is called after it.

SSL initialization for backend connections happens only in the write event
handler since SSL handshake starts with sending Client Hello.  Previously,
if a backend sent a quick plain text response, it could be parsed by the
read event handler prior to starting SSL handshake on the connection.
The change adds protection against parsing such responses on SSL-enabled
connections.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When connecting to a backend, the connection write event is triggered
first in most cases.  However if a response arrives quickly enough, both
read and write events can be triggered together within the same event loop
iteration.  In this case the read event handler is called first and the
write event handler is called after it.

SSL initialization for backend connections happens only in the write event
handler since SSL handshake starts with sending Client Hello.  Previously,
if a backend sent a quick plain text response, it could be parsed by the
read event handler prior to starting SSL handshake on the connection.
The change adds protection against parsing such responses on SSL-enabled
connections.
</pre>
</div>
</content>
</entry>
<entry>
<title>Upstream: add support for connection level ALPN protocol negotiation.</title>
<updated>2025-12-08T03:49:16+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2025-07-15T14:54:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=b8492d9c25c34c87419d2ad118fa812fd72da27c'/>
<id>b8492d9c25c34c87419d2ad118fa812fd72da27c</id>
<content type='text'>
This commit is prepared for HTTP/2 and HTTP/3 support.

The ALPN protocol is now set per-connection in
ngx_http_upstream_ssl_init_connection(), allowing proper protocol negotiation
for each individual upstream connection regardless of SSL context sharing.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit is prepared for HTTP/2 and HTTP/3 support.

The ALPN protocol is now set per-connection in
ngx_http_upstream_ssl_init_connection(), allowing proper protocol negotiation
for each individual upstream connection regardless of SSL context sharing.
</pre>
</div>
</content>
</entry>
<entry>
<title>Upstream: reset local address in case of error.</title>
<updated>2025-10-24T13:49:04+00:00</updated>
<author>
<name>Roman Arutyunyan</name>
<email>arut@nginx.com</email>
</author>
<published>2025-10-23T14:21:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=364a94ecec13037126f28f91cf8f290979ffc229'/>
<id>364a94ecec13037126f28f91cf8f290979ffc229</id>
<content type='text'>
After f10bc5a763bb the address was set to NULL only when local address was
not specified at all.  In case complex value evaluated to an empty or
invalid string, local address remained unchanged.  Currenrly this is not
a problem since the value is only set once.  This change is a preparation
for being able to change the local address after initial setting.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
After f10bc5a763bb the address was set to NULL only when local address was
not specified at all.  In case complex value evaluated to an empty or
invalid string, local address remained unchanged.  Currenrly this is not
a problem since the value is only set once.  This change is a preparation
for being able to change the local address after initial setting.
</pre>
</div>
</content>
</entry>
<entry>
<title>Upstream: overflow detection in Cache-Control delta-seconds.</title>
<updated>2025-09-26T12:50:13+00:00</updated>
<author>
<name>Sergey Kandaurov</name>
<email>pluknet@nginx.com</email>
</author>
<published>2025-09-10T14:39:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=8255bd29ac9a7bcdc317a8889420554e00d435cb'/>
<id>8255bd29ac9a7bcdc317a8889420554e00d435cb</id>
<content type='text'>
Overflowing calculations are now aligned to the greatest positive integer
as specified in RFC 9111, Section 1.2.2.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Overflowing calculations are now aligned to the greatest positive integer
as specified in RFC 9111, Section 1.2.2.
</pre>
</div>
</content>
</entry>
<entry>
<title>Upstream: fixed reinit request with gRPC and Early Hints.</title>
<updated>2025-06-23T16:12:21+00:00</updated>
<author>
<name>Sergey Kandaurov</name>
<email>pluknet@nginx.com</email>
</author>
<published>2025-06-23T10:55:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=cdf7a9c6cb7f344efc80d790fbacdc1c94ab16e3'/>
<id>cdf7a9c6cb7f344efc80d790fbacdc1c94ab16e3</id>
<content type='text'>
The gRPC module context has connection specific state, which can be lost
after request reinitialization when it comes to processing early hints.

The fix is to do only a portion of u-&gt;reinit_request() implementation
required after processing early hints, now inlined in modules.

Now NGX_HTTP_UPSTREAM_EARLY_HINTS is returned from u-&gt;process_header()
for early hints.  When reading a cached response, this code is mapped
to NGX_HTTP_UPSTREAM_INVALID_HEADER to indicate invalid header format.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The gRPC module context has connection specific state, which can be lost
after request reinitialization when it comes to processing early hints.

The fix is to do only a portion of u-&gt;reinit_request() implementation
required after processing early hints, now inlined in modules.

Now NGX_HTTP_UPSTREAM_EARLY_HINTS is returned from u-&gt;process_header()
for early hints.  When reading a cached response, this code is mapped
to NGX_HTTP_UPSTREAM_INVALID_HEADER to indicate invalid header format.
</pre>
</div>
</content>
</entry>
</feed>
