]> git.kaiwu.me - nginx.git/log
nginx.git
2 months agoMp4: validate sync sample values in stss atom.
CodeByMoriarty [Mon, 23 Feb 2026 00:45:47 +0000 (16:45 -0800)]
Mp4: validate sync sample values in stss atom.

Per ISO 14496-12 Section 8.6.2, sync sample numbers must be 1-based.
A zero-valued stss entry caused ngx_http_mp4_seek_key_frame() to
return a key_prefix exceeding the samples consumed in the forward
stts pass, which led the backward loop in ngx_http_mp4_crop_stts_data()
to walk past the beginning of the stts data buffer.

The fix validates each stss entry in ngx_http_mp4_seek_key_frame()
and returns an error if a zero sync sample is encountered.  The
function signature is changed to return ngx_int_t so it can signal
errors to the caller.

2 months agoSCGI: fixed passing CONTENT_LENGTH in unbuffered mode.
Sergey Kandaurov [Fri, 30 Jan 2026 13:06:38 +0000 (17:06 +0400)]
SCGI: fixed passing CONTENT_LENGTH in unbuffered mode.

Passing requests to SCGI uses a recalculated size of a request body
as per changes made in d60b8d10f (1.3.9) to support CONTENT_LENGTH
with chunked body requests.  This, however, is not compatible with
unbuffered mode introduced later in 7ec559df5 (1.7.11), where such
an approach may not always represent complete request body.

The fix is to use r->headers_in.content_length_n representing either
original Content-Length, if any, or a recalculated value from request
body filters, such as chunked body filter.

Reported by Mufeed VH.

2 months agoImproved $cookie_ evaluation.
Vadim Zhestikov [Fri, 19 Dec 2025 00:45:21 +0000 (16:45 -0800)]
Improved $cookie_ evaluation.

In case "Cookie" header is sent by client, multiple cookie pairs were
incorrectly split by a semicolon and comma.

Now they are split by a semicolon only.

For example, next variables will be found for "Cookie: a=b, c=d; e=f":
- $cookie_a: "b, c=d"
- $cookie_e: "f"

Closes #1042 on GitHub.

2 months agoProxy: fixed HTTP/2 upstream with caching enabled.
Roman Arutyunyan [Wed, 11 Feb 2026 12:29:37 +0000 (12:29 +0000)]
Proxy: fixed HTTP/2 upstream with caching enabled.

Previously, when proxy_cache and keepalive were both enabled with an
HTTP/2 upstream, the second request for a cached resource could fail with
"upstream sent frame for unknown stream" error followed by "cache file
contains invalid header".

This happened because ctx->id was set to 1 in the case when no upstream
connection exists (e.g. cache hit), making the stream id check fail when
the cached response contained frames from a different stream.

The fix is to set ctx->id to 0 when there is no upstream connection,
indicating that no real stream exists, and skip the stream id validation
in this case.  Also, ctx->id = 1 is now set only for new connections,
not in the shared done label.

Closes: https://github.com/nginx/nginx/issues/1101
2 months agoVersion bump.
Roman Arutyunyan [Wed, 11 Feb 2026 14:54:35 +0000 (18:54 +0400)]
Version bump.

3 months agonginx-1.29.5-RELEASE release-1.29.5
Roman Arutyunyan [Wed, 4 Feb 2026 13:43:03 +0000 (17:43 +0400)]
nginx-1.29.5-RELEASE

3 months agoUpstream: reinit upstream after reading bad response.
Roman Arutyunyan [Wed, 28 Jan 2026 16:38:38 +0000 (20:38 +0400)]
Upstream: reinit upstream after reading bad response.

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->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.

3 months agoUpstream: detect premature plain text response from SSL backend.
Roman Arutyunyan [Thu, 29 Jan 2026 09:27:32 +0000 (13:27 +0400)]
Upstream: detect premature plain text response from SSL backend.

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.

3 months agoUpdated OpenSSL and PCRE used for win32 builds.
Roman Arutyunyan [Tue, 3 Feb 2026 14:29:43 +0000 (18:29 +0400)]
Updated OpenSSL and PCRE used for win32 builds.

3 months agoOutput chain: clear the last_buf flag unless inherited.
Sergey Kandaurov [Wed, 24 Dec 2025 21:21:52 +0000 (01:21 +0400)]
Output chain: clear the last_buf flag unless inherited.

For instance, the last_buf flag is used in the http proxy module when
creating HTTP/2 requests to indicate the output is closed.  The flag
is inherited in ngx_output_chain() to a destination buffer when reading
the buffered request body.  Then it is used in the proxy output filter
to mark the last HTTP/2 DATA frame with END_STREAM.

The problem happens when reusing the destination buffer, such as to
re-read the buffered request body on next upstream, because this buffer
may contain a dirty last_buf value, which breaks sending HTTP/2 request
body in multiple output filter calls.

The flush and last_in_chain flags are cleared for consistency.

3 months agoProxy: fixed sending HTTP/2 buffered request body on next upstream.
Sergey Kandaurov [Wed, 24 Dec 2025 18:59:40 +0000 (22:59 +0400)]
Proxy: fixed sending HTTP/2 buffered request body on next upstream.

If a buffered request body wasn't fully sent, such as on early upstream
response or limited by flow control, unsent buffers could remain in the
input or busy chains when switching to the next upstream server.  This
resulted either in the invalid request sent or a stalled connection.

The fix is to reset chains similar to ngx_http_upstream_reinit().

3 months agoClarify binding behavior of -t option.
Luboš Uhliarik [Tue, 20 Jan 2026 18:27:05 +0000 (19:27 +0100)]
Clarify binding behavior of -t option.

Configuration testing includes binding to configured listen addresses
when opening referenced files.

3 months agoMisc: revised GitHub documentation in generated ZIP archive.
Sergey Kandaurov [Thu, 15 Jan 2026 12:19:29 +0000 (16:19 +0400)]
Misc: revised GitHub documentation in generated ZIP archive.

Now all GitHub .md files will reside in the docs directory.
While expicitly listing all files might be better for clarity,
this eliminates the need to touch "zip" target every such time.
This includes a recently added SUPPORT.md in 367113670.

3 months agoRange filter: reasonable limit on multiple ranges.
Sergey Kandaurov [Tue, 13 Jan 2026 12:51:07 +0000 (16:51 +0400)]
Range filter: reasonable limit on multiple ranges.

A total response length with multiple ranges can be larger than the
source response size due to multipart boundary headers.  This change
extends max ranges limit imposed in c2c3e3105 (1.1.2) by accounting
boundary headers.  Notably, this covers suspicious requests with a
lot of small ranges that have an increased processing overhead and
are susceptible to range based amplification attacks.

The limit disables ranges as long as a total response length comes
close to the source size, additionally penalizing small size ranges
on a large source size where a processing overhead prevails, while
leaving a room for more ranges on a small source size, such that it
should not affect well-behaving applications.  The limit can be
altered with the "max_ranges" directive.

Closes #988 on GitHub.

3 months agoYear 2026.
Sergey Kandaurov [Thu, 15 Jan 2026 11:54:11 +0000 (15:54 +0400)]
Year 2026.

3 months agoUwsgi: ensure HTTP_HOST is set to the requested target host.
Andrew Clayton [Sat, 13 Dec 2025 07:05:27 +0000 (07:05 +0000)]
Uwsgi: ensure HTTP_HOST is set to the requested target host.

Previously, the HTTP_HOST environment variable was constructed from the
Host request header field, which doesn't work well with HTTP/2 and
HTTP/3 where Host may be supplanted by the ":authority" pseudo-header
field per RFC 9110, section 7.2. Also, it might give an incorrect
HTTP_HOST value from HTTP/1.x requests given in the absolute form, in
which case the Host header must be ignored by the server, per RFC 9112,
section 3.2.2.

The fix is to redefine the HTTP_HOST default from a protocol-specific
value given in the $host variable. This will now use the Host request
header field, ":authority" pseudo-header field, or request line target
URI depending on request HTTP version.

Also the CGI specification (RFC 3875, 4.1.18) notes

  The server SHOULD set meta-variables specific to the protocol and
  scheme for the request. Interpretation of protocol-specific
  variables depends on the protocol version in SERVER_PROTOCOL.

3 months agoSCGI: ensure HTTP_HOST is set to the requested target host.
Andrew Clayton [Sat, 13 Dec 2025 07:05:27 +0000 (07:05 +0000)]
SCGI: ensure HTTP_HOST is set to the requested target host.

Previously, the HTTP_HOST environment variable was constructed from the
Host request header field, which doesn't work well with HTTP/2 and
HTTP/3 where Host may be supplanted by the ":authority" pseudo-header
field per RFC 9110, section 7.2. Also, it might give an incorrect
HTTP_HOST value from HTTP/1.x requests given in the absolute form, in
which case the Host header must be ignored by the server, per RFC 9112,
section 3.2.2.

The fix is to redefine the HTTP_HOST default from a protocol-specific
value given in the $host variable. This will now use the Host request
header field, ":authority" pseudo-header field, or request line target
URI depending on request HTTP version.

Also the CGI specification (RFC 3875, 4.1.18) notes

  The server SHOULD set meta-variables specific to the protocol and
  scheme for the request. Interpretation of protocol-specific
  variables depends on the protocol version in SERVER_PROTOCOL.

3 months agoFastCGI: ensure HTTP_HOST is set to the requested target host.
Andrew Clayton [Sat, 13 Dec 2025 07:05:27 +0000 (07:05 +0000)]
FastCGI: ensure HTTP_HOST is set to the requested target host.

Previously, the HTTP_HOST environment variable was constructed from the
Host request header field, which doesn't work well with HTTP/2 and
HTTP/3 where Host may be supplanted by the ":authority" pseudo-header
field per RFC 9110, section 7.2. Also, it might give an incorrect
HTTP_HOST value from HTTP/1.x requests given in the absolute form, in
which case the Host header must be ignored by the server, per RFC 9112,
section 3.2.2.

The fix is to redefine the HTTP_HOST default from a protocol-specific
value given in the $host variable. This will now use the Host request
header field, ":authority" pseudo-header field, or request line target
URI depending on request HTTP version.

Also the CGI specification (RFC 3875, 4.1.18) notes

  The server SHOULD set meta-variables specific to the protocol and
  scheme for the request. Interpretation of protocol-specific
  variables depends on the protocol version in SERVER_PROTOCOL.

Closes: https://github.com/nginx/nginx/issues/256
Closes: https://github.com/nginx/nginx/issues/455
Closes: https://github.com/nginx/nginx/issues/912
4 months agoWin32: fixed C4319 warning with MSVC 2022 x86.
Aleksei Bavshin [Tue, 23 Dec 2025 18:44:13 +0000 (10:44 -0800)]
Win32: fixed C4319 warning with MSVC 2022 x86.

The warning started to appear in Visual Studio 2022 version 17.14.21,
which corresponds to the C/C++ compiler version 19.44.35221.

The appropriate fix is to avoid mixing uint64_t and ngx_uint_t in an
expression with bitwise operations.  We can do that here because both
the original shm->size value and the result of the expression are 32-bit
platform words.

4 months agoSSL: logging level of the "ech_required" TLS alert.
Roman Arutyunyan [Tue, 16 Dec 2025 13:53:12 +0000 (17:53 +0400)]
SSL: logging level of the "ech_required" TLS alert.

The alert is send by a client after its ECH configuration was rejected by
a server.

4 months agoFixed duplicate ids in the bug report template.
Aleksei Bavshin [Mon, 15 Dec 2025 20:49:37 +0000 (12:49 -0800)]
Fixed duplicate ids in the bug report template.

4 months agoVersion bump.
Aleksei Bavshin [Tue, 16 Dec 2025 21:18:30 +0000 (13:18 -0800)]
Version bump.

5 months agonginx-1.29.4-RELEASE release-1.29.4
Sergey Kandaurov [Tue, 9 Dec 2025 15:12:35 +0000 (19:12 +0400)]
nginx-1.29.4-RELEASE

5 months agoQUIC: fixed possible segfault on handshake failures.
Jan Svojanovsky [Tue, 9 Dec 2025 11:27:02 +0000 (12:27 +0100)]
QUIC: fixed possible segfault on handshake failures.

When using OpenSSL 3.5, the crypto_release_rcd QUIC callback can be
called late, after the QUIC connection was already closed on handshake
failure, resulting in a segmentation fault.  For instance, it happened
if a client Finished message didn't align with a record boundary.

5 months agoProxy: cache support for HTTP/2.
Zhidao HONG [Sun, 30 Nov 2025 16:35:31 +0000 (16:35 +0000)]
Proxy: cache support for HTTP/2.

5 months agoProxy: buffering support for HTTP/2.
Zhidao HONG [Sun, 30 Nov 2025 16:32:15 +0000 (16:32 +0000)]
Proxy: buffering support for HTTP/2.

5 months agoProxy: extracted control frame and skip functions for HTTP/2.
Zhidao HONG [Sun, 30 Nov 2025 16:27:26 +0000 (16:27 +0000)]
Proxy: extracted control frame and skip functions for HTTP/2.

5 months agoProxy: extracted ngx_http_proxy_v2_process_frames() function.
Zhidao HONG [Sun, 30 Nov 2025 16:24:24 +0000 (16:24 +0000)]
Proxy: extracted ngx_http_proxy_v2_process_frames() function.

5 months agoProxy: added HTTP/2 proxy module.
Zhidao HONG [Tue, 15 Jul 2025 15:35:39 +0000 (15:35 +0000)]
Proxy: added HTTP/2 proxy module.

The module allows to use HTTP/2 protocol for proxying.
HTTP/2 proxying is enabled by specifying "proxy_http_version 2".

Example:

    server {
        listen 8000;

        location / {
            proxy_http_version 2;
            proxy_pass https://127.0.0.1:8443;
        }
    }

    server {
        listen 8443 ssl;
        http2 on;

        ssl_certificate certs/example.com.crt;
        ssl_certificate_key certs/example.com.key;

        location / {
            return 200 foo;
        }
    }

5 months agoProxy: refactored for HTTP/2 support.
Roman Arutyunyan [Tue, 15 Jul 2025 15:03:39 +0000 (15:03 +0000)]
Proxy: refactored for HTTP/2 support.

5 months agoUpstream: add support for connection level ALPN protocol negotiation.
Zhidao HONG [Tue, 15 Jul 2025 14:54:21 +0000 (14:54 +0000)]
Upstream: add support for connection level ALPN protocol negotiation.

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.

5 months agoDisabled bare LF in chunked transfer encoding.
Sergey Kandaurov [Mon, 24 Nov 2025 22:06:29 +0000 (02:06 +0400)]
Disabled bare LF in chunked transfer encoding.

Chunked transfer encoding, since originally introduced in HTTP/1.1
in RFC 2068, is specified to use CRLF as the only line terminator.

Although tolerant applications may recognize a single LF, formally
this covers the start line and fields, and doesn't apply to chunks.
Strict chunked parsing is reaffirmed as intentional in RFC errata
ID 7633, notably "because it does not have to retain backwards
compatibility with 1.0 parsers".

A general RFC 2616 recommendation to tolerate deviations whenever
interpreted unambiguously doesn't apply here, because chunked body
is used to determine HTTP message framing; a relaxed parsing may
cause various security problems due to a broken delimitation.
For instance, this is possible when receiving chunked body from
intermediates that blindly parse chunk-ext or a trailer section
until CRLF, and pass it further without re-coding.

5 months agoSSL: avoid warning when ECH is not configured and not supported.
QirunGao [Tue, 2 Dec 2025 22:32:47 +0000 (23:32 +0100)]
SSL: avoid warning when ECH is not configured and not supported.

5 months agoUpdate GitHub templates and markdown files.
Alessandro Fael Garcia [Tue, 10 Jun 2025 14:14:53 +0000 (16:14 +0200)]
Update GitHub templates and markdown files.

- Issue templates are replaced with forms.  Forms allow to explicitly ask
  for certain info before an issue is opened, they can be programmatically
  queried via GH actions to get the data in fields.

- Added language around GH discussions vs the forum in the issue forms.

- Added GH discussions templates.  These templates delineate which types
  of discussions belong on GitHub vs the community forum.

- Created SUPPORT.md to delineate which types of topics belong on GitHub
  vs different support channels (community forum/docs/commercial support).

- Updated CONTRIBUTING.md:
  - Removed text that belongs in SUPPORT.md.
  - Added F5 CLA clarifying text.

- Added badges to README.md.  Most of these are there to make information
  even clearer, moreso for users reading README.md from sources outside
  GitHub.

5 months agoAdd basic ECH shared-mode via OpenSSL.
sftcd [Wed, 26 Nov 2025 14:12:07 +0000 (14:12 +0000)]
Add basic ECH shared-mode via OpenSSL.

5 months agoProxy: fixed segfault in URI change.
Sergey Kandaurov [Mon, 24 Nov 2025 11:57:09 +0000 (15:57 +0400)]
Proxy: fixed segfault in URI change.

If request URI was shorter than location prefix, as after replacement
with try_files, location length was used to copy the remaining URI part
leading to buffer overread.

The fix is to replace full request URI in this case.  In the following
configuration, request "/123" is changed to "/" when sent to backend.

    location /1234 {
        try_files /123 =404;
        proxy_pass http://127.0.0.1:8080/;
    }

Closes #983 on GitHub.

5 months agoChanged interface of ngx_http_validate_host().
Sergey Kandaurov [Wed, 5 Nov 2025 12:15:12 +0000 (16:15 +0400)]
Changed interface of ngx_http_validate_host().

This allows to process a port subcomponent and save it in r->port
in a unified way, similar to r->headers_in.server.  For HTTP/1.x
request line in the absolute form, r->host_end now includes a port
subcomponent, which is also consistent with HTTP/2 and HTTP/3.

5 months agoImproved host header validation.
Sergey Kandaurov [Tue, 4 Nov 2025 12:34:32 +0000 (16:34 +0400)]
Improved host header validation.

Validation is rewritten to follow RFC 3986 host syntax, based on
ngx_http_parse_request_line().  The following is now rejected:
- the rest of gen-delims "#", "?", "@", "[", "]"
- other unwise delims <">, "<", ">", "\", "^", "`', "{", "|", "}"
- IP literals with a trailing dot, missing closing bracket, or pct-encoded
- a port subcomponent with invalid values
- characters in upper half

5 months agoHTTP/2: extended guard for NULL buffer and zero length.
Sergey Kandaurov [Fri, 14 Nov 2025 14:14:18 +0000 (18:14 +0400)]
HTTP/2: extended guard for NULL buffer and zero length.

In addition to moving memcpy() under the length condition in 15bf6d8cc,
which addressed a reported UB due to string function conventions, this
is repeated for advancing an input buffer, to make the resulting code
more clean and readable.

Additionally, although considered harmless for both string functions and
additive operators, as previously discussed in GitHub PR 866, this fixes
the main source of annoying sanitizer reports in the module.

Prodded by UndefinedBehaviorSanitizer (pointer-overflow).

6 months agoSSL: fixed build with BoringSSL, broken by 38a701d88.
Sergey Kandaurov [Mon, 10 Nov 2025 17:36:40 +0000 (21:36 +0400)]
SSL: fixed build with BoringSSL, broken by 38a701d88.

6 months agoSSL: ngx_ssl_set_client_hello_callback() error handling.
Sergey Kandaurov [Thu, 6 Nov 2025 13:30:41 +0000 (17:30 +0400)]
SSL: ngx_ssl_set_client_hello_callback() error handling.

The function interface is changed to follow a common approach
to other functions used to setup SSL_CTX, with an exception of
"ngx_conf_t *cf" since it is not bound to nginx configuration.

This is required to report and propagate SSL_CTX_set_ex_data()
errors, as reminded by Coverity (CID 1668589).

6 months agoConfigure: MSVC compatibility with PCRE2 10.47.
Thierry Bastian [Tue, 4 Nov 2025 17:28:52 +0000 (18:28 +0100)]
Configure: MSVC compatibility with PCRE2 10.47.

6 months agoVersion bump.
Sergey Kandaurov [Thu, 6 Nov 2025 11:31:37 +0000 (15:31 +0400)]
Version bump.

6 months agoConfigure: ensure we get the "built by ..." line in nginx -V.
Andrew Clayton [Tue, 23 Sep 2025 02:46:43 +0000 (03:46 +0100)]
Configure: ensure we get the "built by ..." line in nginx -V.

For certain compilers we embed the compiler version used to build nginx
in the binary, retrievable via 'nginx -V', e.g.

  $ ./objs/nginx -V
  ...
  built by gcc 15.2.1 20250808 (Red Hat 15.2.1-1) (GCC)
  ...

However if the CFLAGS environment variable is set this would be omitted.

This is due to the compiler specific auto/cc files not being run when
the CFLAGS environment variable is set, this is so entities can set
their own compiler flags, and thus the NGX_COMPILER variable isn't set.

Nonetheless it is a useful thing to have so re-work the auto scripts to
move the version gathering out of the individual auto/cc/$NGX_CC_NAME
files and merge them into auto/cc/name.

Link: <https://github.com/nginx/nginx/issues/878>

6 months agonginx-1.29.3-RELEASE release-1.29.3
Roman Arutyunyan [Mon, 27 Oct 2025 11:32:12 +0000 (15:32 +0400)]
nginx-1.29.3-RELEASE

6 months agoModules compatibility: increased compat section size.
Roman Arutyunyan [Mon, 27 Oct 2025 12:12:46 +0000 (16:12 +0400)]
Modules compatibility: increased compat section size.

6 months agoFixed compilation warnings on Windows after c93a0c48af87.
Roman Arutyunyan [Mon, 27 Oct 2025 17:16:49 +0000 (21:16 +0400)]
Fixed compilation warnings on Windows after c93a0c48af87.

6 months agoOCSP: fixed invalid type for the 'ssl_ocsp' directive.
Roman Semenov [Wed, 22 Oct 2025 18:24:27 +0000 (11:24 -0700)]
OCSP: fixed invalid type for the 'ssl_ocsp' directive.

6 months agoHeaders filter: inheritance control for add_header and add_trailer.
Roman Arutyunyan [Mon, 14 Jul 2025 17:44:05 +0000 (21:44 +0400)]
Headers filter: inheritance control for add_header and add_trailer.

The new directives add_header_inherit and add_trailer_inherit allow
to alter inheritance rules for the values specified in the add_header
and add_trailer directives in a convenient way.

The "merge" parameter enables appending the values from the previous level
to the current level values.

The "off" parameter cancels inheritance of the values from the previous
configuration level, similar to add_header "" (2194e75bb).

The "on" parameter (default) enables the standard inheritance behaviour,
which is to inherit values from the previous level only if there are no
directives on the current level.

The inheritance rules themselves are inherited in a standard way.  Thus,
for example, "add_header_inherit merge;" specified at the top level will
be inherited in all nested levels recursively unless redefined below.

6 months agoGeo: the "volatile" parameter.
Dmitry Plotnikov [Tue, 21 Oct 2025 19:48:36 +0000 (19:48 +0000)]
Geo: the "volatile" parameter.

Similar to map's volatile parameter, creates a non-cacheable geo variable.

6 months agoSSL: $ssl_sigalg, $ssl_client_sigalg.
Sergey Kandaurov [Fri, 17 Oct 2025 16:38:17 +0000 (20:38 +0400)]
SSL: $ssl_sigalg, $ssl_client_sigalg.

Variables contain the IANA name of the signature scheme[1] used to sign
the TLS handshake.

Variables are only meaningful when using OpenSSL 3.5 and above, with older
versions they are empty.  Moreover, since this data isn't stored in a
serialized session, variables are only available for new sessions.

[1] https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml

Requested by willmafh.

6 months agoUpstream: reset local address in case of error.
Roman Arutyunyan [Thu, 23 Oct 2025 14:21:57 +0000 (18:21 +0400)]
Upstream: reset local address in case of error.

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.

6 months agoCONNECT method support for HTTP/1.1.
Roman Arutyunyan [Tue, 23 Sep 2025 11:03:52 +0000 (15:03 +0400)]
CONNECT method support for HTTP/1.1.

The change allows modules to use the CONNECT method with HTTP/1.1 requests.
To do so, they need to set the "allow_connect" flag in the core server
configuration.

6 months agoAdded $request_port and $is_request_port variables.
Roman Arutyunyan [Mon, 29 Sep 2025 16:47:27 +0000 (20:47 +0400)]
Added $request_port and $is_request_port variables.

The $request_port variable contains the port passed by the client in the
request line (for HTTP/1.x) or ":authority" pseudo-header (for HTTP/2 and
HTTP/3).  If the request line contains no host, or ":authority" is missing,
then $request_port is taken from the "Host" header, similar to the $host
variable.

The $is_request_port variable contains ":" if $request_port is non-empty,
and is empty otherwise.

7 months agoSSL: support for compressed server certificates with BoringSSL.
Sergey Kandaurov [Tue, 15 Jul 2025 18:22:53 +0000 (22:22 +0400)]
SSL: support for compressed server certificates with BoringSSL.

BoringSSL/AWS-LC provide two callbacks for each compression algorithm,
which may be used to compress and decompress certificates in runtime.
This change implements compression support with zlib, as enabled with
the ssl_certificate_compression directive.  Compressed certificates
are stored in certificate exdata and reused in subsequent connections.

Notably, AWS-LC saves an X509 pointer in SSL connection, which allows
to use it from SSL_get_certificate() for caching purpose.  In contrast,
BoringSSL reconstructs X509 on-the-fly, though given that it doesn't
support multiple certificates, always replacing previously configured
certificates, we use the last configured one from ssl->certs, instead.

7 months agoSSL: disabled using certificate compression with OCSP stapling.
Sergey Kandaurov [Thu, 2 Oct 2025 11:22:24 +0000 (15:22 +0400)]
SSL: disabled using certificate compression with OCSP stapling.

OCSP response in TLSv1.3 is sent in the Certificate message.  This
is incompatible with pre-compression of the configured certificates.

7 months agoUpdated OpenSSL and PCRE used for win32 builds.
Sergey Kandaurov [Tue, 7 Oct 2025 18:21:37 +0000 (22:21 +0400)]
Updated OpenSSL and PCRE used for win32 builds.

7 months agoVersion bump.
Sergey Kandaurov [Tue, 7 Oct 2025 18:19:01 +0000 (22:19 +0400)]
Version bump.

7 months agonginx-1.29.2-RELEASE release-1.29.2
Sergey Kandaurov [Tue, 7 Oct 2025 12:46:15 +0000 (16:46 +0400)]
nginx-1.29.2-RELEASE

7 months agoFixed a typo.
Sergey Kandaurov [Tue, 7 Oct 2025 13:05:09 +0000 (17:05 +0400)]
Fixed a typo.

7 months agoSSL: fixed "key values mismatch" with object cache inheritance.
Sergey Kandaurov [Thu, 29 May 2025 13:49:48 +0000 (17:49 +0400)]
SSL: fixed "key values mismatch" with object cache inheritance.

In rare cases, it was possible to get into this error state on reload
with improperly updated file timestamps for certificate and key pairs.

The fix is to retry on X509_R_KEY_VALUES_MISMATCH, similar to 5d5d9adcc.
Additionally, loading SSL certificate is updated to avoid certificates
discarded on retry to appear in ssl->certs and in extra chain.

7 months agoAdded F5 CLA workflow.
Maryna-f5 [Thu, 25 Sep 2025 19:51:40 +0000 (12:51 -0700)]
Added F5 CLA workflow.

7 months agoMail: xtext encoding (RFC 3461) in XCLIENT LOGIN.
Sergey Kandaurov [Thu, 11 Sep 2025 14:23:10 +0000 (18:23 +0400)]
Mail: xtext encoding (RFC 3461) in XCLIENT LOGIN.

The XCLIENT command uses xtext encoding for attribute values,
as specified in https://www.postfix.org/XCLIENT_README.html.

Reported by Igor Morgenstern of Aisle Research.

7 months agoUpstream: overflow detection in Cache-Control delta-seconds.
Sergey Kandaurov [Wed, 10 Sep 2025 14:39:52 +0000 (18:39 +0400)]
Upstream: overflow detection in Cache-Control delta-seconds.

Overflowing calculations are now aligned to the greatest positive integer
as specified in RFC 9111, Section 1.2.2.

7 months agoSSL: AWS-LC compatibility.
Sergey Kandaurov [Wed, 30 Jul 2025 12:26:21 +0000 (16:26 +0400)]
SSL: AWS-LC compatibility.

7 months agoQUIC: a new macro to differentiate BoringSSL specific EVP API.
Sergey Kandaurov [Wed, 30 Jul 2025 12:23:43 +0000 (16:23 +0400)]
QUIC: a new macro to differentiate BoringSSL specific EVP API.

7 months agoQUIC: localized OpenSSL headers used for QUIC protection.
Sergey Kandaurov [Wed, 30 Jul 2025 12:09:21 +0000 (16:09 +0400)]
QUIC: localized OpenSSL headers used for QUIC protection.

7 months agoSNI: support for early ClientHello callback with BoringSSL.
Sergey Kandaurov [Mon, 22 Sep 2025 15:55:16 +0000 (19:55 +0400)]
SNI: support for early ClientHello callback with BoringSSL.

This brings feature parity with OpenSSL after the previous change,
making it possible to set SSL protocols per virtual server.

7 months agoSNI: using the ClientHello callback.
Sergey Kandaurov [Mon, 27 Jan 2025 20:53:15 +0000 (00:53 +0400)]
SNI: using the ClientHello callback.

The change introduces an SNI based virtual server selection during
early ClientHello processing.  The callback is available since
OpenSSL 1.1.1; for older OpenSSL versions, the previous behaviour
is kept.

Using the ClientHello callback sets a reasonable processing order
for the "server_name" TLS extension.  Notably, session resumption
decision now happens after applying server configuration chosen by
SNI, useful with enabled verification of client certificates, which
brings consistency with BoringSSL behaviour.  The change supersedes
and reverts a fix made in 46b9f5d38 for TLSv1.3 resumed sessions.

In addition, since the callback is invoked prior to the protocol
version negotiation, this makes it possible to set "ssl_protocols"
on a per-virtual server basis.

To keep the $ssl_server_name variable working with TLSv1.2 resumed
sessions, as previously fixed in fd97b2a80, a limited server name
callback is preserved in order to acknowledge the extension.

Note that to allow third-party modules to properly chain the call to
ngx_ssl_client_hello_callback(), the servername callback function is
passed through exdata.

7 months agoFixed inaccurate index directive error report.
willmafh [Mon, 8 Sep 2025 14:03:30 +0000 (22:03 +0800)]
Fixed inaccurate index directive error report.

7 months agoUpdated link to xslscript.
Sergey Kandaurov [Mon, 18 Aug 2025 18:10:25 +0000 (22:10 +0400)]
Updated link to xslscript.

7 months agoQUIC: fixed ssl_reject_handshake error handling.
Sergey Kandaurov [Wed, 10 Sep 2025 13:25:36 +0000 (17:25 +0400)]
QUIC: fixed ssl_reject_handshake error handling.

This was broken in 7468a10b6 (1.29.0), resulting in a missing diagnostics
and SSL error queue not cleared for SSL handshakes rejected by SNI, seen
as "ignoring stale global SSL error" alerts, for instance, when doing SSL
shutdown of a long standing connection after rejecting another one by SNI.

The fix is to move the qc->error check after c->ssl->handshake_rejected is
handled first, to make the error queue cleared.  Although not practicably
visible as needed, this is accompanied by clearing the error queue under
the qc->error case as well, to be on the safe side.

As an implementation note, due to the way of handling invalid transport
parameters for OpenSSL 3.5 and above, which leaves a passed pointer not
advanced on error, SSL_get_error() may return either SSL_ERROR_WANT_READ
or SSL_ERROR_WANT_WRITE depending on a library.  To cope with that, both
qc->error and c->ssl->handshake_rejected checks were moved out of
"sslerr != SSL_ERROR_WANT_READ".

Also, this reconstructs a missing "SSL_do_handshake() failed" diagnostics
for the qc->error case, replacing using ngx_ssl_connection_error() with
ngx_connection_error().  It is made this way to avoid logging at the crit
log level because qc->error set is expected to have an empty error queue.

Reported and tested by Vladimir Homutov.

8 months agoRemoved legacy charset directive from default config example.
Mohamed Karrab [Mon, 18 Aug 2025 19:28:06 +0000 (20:28 +0100)]
Removed legacy charset directive from default config example.

The example configuration previously specified 'charset koi8-r',
which is a legacy Cyrillic encoding.  As koi8-r is rarely used today
and modern browsers handle UTF-8 by default, specifying the charset
explicitly is unnecessary.  Removing the directive keeps the example
configuration concise and aligned with current best practices.

8 months agoAdded a previously missed changes entry in 1.29.1 relnotes.
Sergey Kandaurov [Wed, 13 Aug 2025 16:26:56 +0000 (20:26 +0400)]
Added a previously missed changes entry in 1.29.1 relnotes.

8 months agoVersion bump.
Sergey Kandaurov [Wed, 13 Aug 2025 16:07:38 +0000 (20:07 +0400)]
Version bump.

8 months agonginx-1.29.1-RELEASE release-1.29.1
Sergey Kandaurov [Tue, 12 Aug 2025 14:46:04 +0000 (18:46 +0400)]
nginx-1.29.1-RELEASE

8 months agoUpdated OpenSSL used for win32 builds.
Sergey Kandaurov [Wed, 13 Aug 2025 13:55:56 +0000 (17:55 +0400)]
Updated OpenSSL used for win32 builds.

8 months agoMail: logging upstream to the error log with "smtp_auth none;".
Sergey Kandaurov [Mon, 21 Jul 2025 13:44:28 +0000 (17:44 +0400)]
Mail: logging upstream to the error log with "smtp_auth none;".

Previously, it was never logged because of missing login.

8 months agoMail: reset stale auth credentials with "smtp_auth none;".
Sergey Kandaurov [Mon, 7 Jul 2025 19:48:44 +0000 (23:48 +0400)]
Mail: reset stale auth credentials with "smtp_auth none;".

They might be reused in a session if an SMTP client proceeded
unauthenticated after previous invalid authentication attempts.
This could confuse an authentication server when passing stale
credentials along with "Auth-Method: none".

The condition to send the "Auth-Salt" header is similarly refined.

8 months agoMail: improved error handling in plain/login/cram-md5 auth methods.
Sergey Kandaurov [Tue, 12 Aug 2025 11:55:02 +0000 (15:55 +0400)]
Mail: improved error handling in plain/login/cram-md5 auth methods.

Previously, login and password storage could be left in inconsistent
state in a session after decoding errors.

9 months agoAuth basic: fixed file descriptor leak on memory allocation error.
Sergey Kandaurov [Fri, 8 Aug 2025 15:44:27 +0000 (19:44 +0400)]
Auth basic: fixed file descriptor leak on memory allocation error.

Found by Coverity (CID 1662016).

9 months agoSSL: support for compressed server certificates with OpenSSL.
Sergey Kandaurov [Wed, 9 Jul 2025 15:02:09 +0000 (19:02 +0400)]
SSL: support for compressed server certificates with OpenSSL.

The ssl_certificate_compression directive allows to send compressed
server certificates.  In OpenSSL, they are pre-compressed on startup.
To simplify configuration, the SSL_OP_NO_TX_CERTIFICATE_COMPRESSION
option is automatically cleared if certificates were pre-compressed.

SSL_CTX_compress_certs() may return an error in legitimate cases,
e.g., when none of compression algorithms is available or if the
resulting compressed size is larger than the original one, thus it
is silently ignored.

Certificate compression is supported in Chrome with brotli only,
in Safari with zlib only, and in Firefox with all listed algorithms.
It is supported since Ubuntu 24.10, which has OpenSSL with enabled
zlib and zstd support.

The actual list of algorithms supported in OpenSSL depends on how
the library was configured; it can be brotli, zlib, zstd as listed
in RFC 8879.

9 months agoSSL: disabled certificate compression by default with OpenSSL.
Sergey Kandaurov [Tue, 15 Jul 2025 11:55:26 +0000 (15:55 +0400)]
SSL: disabled certificate compression by default with OpenSSL.

Certificate compression is supported since OpenSSL 3.2, it is enabled
automatically as negotiated in a TLSv1.3 handshake.

Using certificate compression and decompression in runtime may be
suboptimal in terms of CPU and memory consumption in certain typical
scenarios, hence it is disabled by default on both server and client
sides.  It can be enabled with ssl_conf_command and similar directives
in upstream as appropriate, for example:

    ssl_conf_command Options RxCertificateCompression;
    ssl_conf_command Options TxCertificateCompression;

Compressing server certificates requires additional support, this is
addressed separately.

9 months agoUpdated ngx_http_process_multi_header_lines() comments.
Sergey Kandaurov [Thu, 31 Jul 2025 17:31:27 +0000 (21:31 +0400)]
Updated ngx_http_process_multi_header_lines() comments.

Missed in fcf4331a0.

9 months agoHTTP/3: improved invalid ":authority" error message.
Sergey Kandaurov [Wed, 30 Jul 2025 13:43:44 +0000 (17:43 +0400)]
HTTP/3: improved invalid ":authority" error message.

9 months agoMade ngx_http_process_request_header() static again.
Sergey Kandaurov [Wed, 23 Jul 2025 11:56:37 +0000 (15:56 +0400)]
Made ngx_http_process_request_header() static again.

The function contains mostly HTTP/1.x specific request processing,
which has no use in other protocols.  After the previous change in
HTTP/2, it can now be hidden.

This is an API change.

9 months agoHTTP/2: fixed handling of the ":authority" header.
Sergey Kandaurov [Wed, 23 Jul 2025 10:54:07 +0000 (14:54 +0400)]
HTTP/2: fixed handling of the ":authority" header.

Previously, it misused the Host header processing resulting in
400 (Bad Request) errors for a valid request that contains both
":authority" and Host headers with the same value, treating it
after 37984f0be as if client sent more than one Host header.
Such an overly strict handling violates RFC 9113.

The fix is to process ":authority" as a distinct header, similarly
to processing an authority component in the HTTP/1.x request line.
This allows to disambiguate and compare Host and ":authority"
values after all headers were processed.

With this change, the ngx_http_process_request_header() function
can no longer be used here, certain parts were inlined similar to
the HTTP/3 module.

To provide compatibility for misconfigurations that use $http_host
to return the value of the ":authority" header, the Host header,
if missing, is now reconstructed from ":authority".

9 months agoHTTP/2: factored out constructing the Host header.
Sergey Kandaurov [Wed, 23 Jul 2025 10:32:34 +0000 (14:32 +0400)]
HTTP/2: factored out constructing the Host header.

No functional changes.

9 months agoHTTP/2: fixed flushing early hints over SSL.
Roman Arutyunyan [Thu, 24 Jul 2025 14:29:21 +0000 (18:29 +0400)]
HTTP/2: fixed flushing early hints over SSL.

Previously, when using HTTP/2 over SSL, an early hints HEADERS frame was
queued in SSL buffer, and might not be immediately flushed.  This resulted
in a delay of early hints delivery until the main response was sent.

The fix is to set the flush flag for the early hints HEADERS frame buffer.

9 months agoHTTP/3: fixed handling of :authority and Host with port.
Roman Arutyunyan [Thu, 26 Jun 2025 16:19:59 +0000 (20:19 +0400)]
HTTP/3: fixed handling of :authority and Host with port.

RFC 9114, Section 4.3.1. specifies a restriction for :authority and Host
coexistence in an HTTP/3 request:

: If both fields are present, they MUST contain the same value.

Previously, this restriction was correctly enforced only for portless
values.  When Host contained a port, the request failed as if :authority
and Host were different, regardless of :authority presence.

This happens because the value of r->headers_in.server used for :authority
has port stripped.  The fix is to use r->host_start / r->host_end instead.

9 months agoHTTP/3: fixed potential type overflow in string literal parser.
Sergey Kandaurov [Thu, 5 Sep 2024 15:35:43 +0000 (19:35 +0400)]
HTTP/3: fixed potential type overflow in string literal parser.

This might happen for Huffman encoded string literals as the result
of length expansion.  Notably, the maximum length of string literals
is already limited with the "large_client_header_buffers" directive,
so this was only possible with nonsensically large configured limits.

10 months agoEvents: compatibility with NetBSD 10.0 in kqueue.
Sergey Kandaurov [Thu, 10 Jul 2025 12:59:05 +0000 (16:59 +0400)]
Events: compatibility with NetBSD 10.0 in kqueue.

The kevent udata field was changed from intptr_t to "void *",
similar to other BSDs and Darwin.

The NGX_KQUEUE_UDATA_T macro is adjusted to reflect that change,
fixing -Werror=int-conversion errors.

10 months agoConfigure: set NGX_KQUEUE_UDATA_T at compile time.
Sergey Kandaurov [Thu, 10 Jul 2025 12:30:35 +0000 (16:30 +0400)]
Configure: set NGX_KQUEUE_UDATA_T at compile time.

The NGX_KQUEUE_UDATA_T macro is used to compensate the incompatible
kqueue() API in NetBSD, it doesn't really belong to feature tests.

The change limits the macro visibility to the kqueue event module.
Moving from autotests also simplifies testing a particular NetBSD
version as seen in a subsequent change.

10 months agoEvents: fixed -Wzero-as-null-pointer-constant warnings in kqueue.
Sergey Kandaurov [Tue, 8 Jul 2025 18:45:33 +0000 (22:45 +0400)]
Events: fixed -Wzero-as-null-pointer-constant warnings in kqueue.

The kevent udata field is special in that we maintain compatibility
with NetBSD versions that predate using the "void *" type.

The fix is to cast to intermediate uintptr_t that is casted back to
"void *" where appropriate.

10 months agoSSL: fixed testing OPENSSL_VERSION_NUMBER for OpenSSL 3.0+.
Sergey Kandaurov [Tue, 8 Jul 2025 14:07:04 +0000 (18:07 +0400)]
SSL: fixed testing OPENSSL_VERSION_NUMBER for OpenSSL 3.0+.

Prior to OpenSSL 3.0, OPENSSL_VERSION_NUMBER used the following format:

MNNFFPPS: major minor fix patch status

Where the status nibble (S) has 0+ for development and f for release.

The format was changed in OpenSSL 3.0.0, where it is always zero:

MNN00PP0: major minor patch

10 months agoSSL: SSL_group_to_name() compatibility macro.
Sergey Kandaurov [Tue, 8 Jul 2025 13:59:50 +0000 (17:59 +0400)]
SSL: SSL_group_to_name() compatibility macro.

No functional changes.

10 months agoQUIC: adjusted OpenSSL 3.5 QUIC API feature test.
Sergey Kandaurov [Sun, 22 Jun 2025 16:40:05 +0000 (20:40 +0400)]
QUIC: adjusted OpenSSL 3.5 QUIC API feature test.

A bug with the "quic_transport_parameters" extension and SNI described
in cedb855d7 is now fixed in the OpenSSL 3.5.1 release, as requested
in https://github.com/openssl/openssl/pull/27706.

10 months agoWin32: fixed PCRE license for nginx/Windows zip.
Sergey Kandaurov [Tue, 24 Jun 2025 18:46:00 +0000 (22:46 +0400)]
Win32: fixed PCRE license for nginx/Windows zip.

10 months agoVersion bump.
Sergey Kandaurov [Tue, 24 Jun 2025 18:45:32 +0000 (22:45 +0400)]
Version bump.

10 months agonginx-1.29.0-RELEASE release-1.29.0
Sergey Kandaurov [Tue, 24 Jun 2025 12:40:21 +0000 (16:40 +0400)]
nginx-1.29.0-RELEASE