[PATCH 2 of 3] HTTP/2: "http2" directive

Sergey Kandaurov pluknet at nginx.com
Tue May 30 13:54:03 UTC 2023

On Tue, May 16, 2023 at 04:39:38PM +0400, Roman Arutyunyan wrote:
> Hi,
> # HG changeset patch
> # User Roman Arutyunyan <arut at nginx.com>
> # Date 1684240208 -14400
> #      Tue May 16 16:30:08 2023 +0400
> # Branch quic
> # Node ID 4dcd2b42c23973815a6b8a7f54bbd1460c314c93
> # Parent  d8272b84031bea1940ef8a5b8e2f79ec6a2dcfc1
> HTTP/2: "http2" directive.
> The directive enables HTTP/2 in the current server.  The previous way to
> enable HTTP/2 via "listen ... http2" is now deprecated.  The new approach
> allows to share HTTP/2 and HTTP/0.9-1.1 on the same port.
> For SSL connections, HTTP/2 is now selected by ALPN callback based on whether
> the protocol is enabled in the virtual server chosen by SNI.  This however only
> works since OpenSSL 1.0.2h, where ALPN callback is invoked after SNI callback.
> For older versions of OpenSSL, HTTP/2 is enabled based on the default virtual
> server configuration.
> For plain TCP connections, HTTP/2 is now auto-detected by HTTP/2 preface, if
> HTTP/2 is enabled in the default virtual server.  If preface is not matched,
> HTTP/0.9-1.1 is assumed.

You might also note that HTTP/2 detection by connection preface also affects 
the now deprecated "listen .. http2" configuration.

Either way, looks good.

More information about the nginx-devel mailing list