From: Rich Bowen Date: Thu, 18 Jun 2026 13:16:55 +0000 (+0000) Subject: Updates to correctly use and X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9837d08962452c2903e36e80e28d45de2e6dd478;p=thirdparty%2Fapache%2Fhttpd.git Updates to correctly use and as per the style guide. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935472 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/howto/http2.xml b/docs/manual/howto/http2.xml index bef9443f97..836aa99b04 100644 --- a/docs/manual/howto/http2.xml +++ b/docs/manual/howto/http2.xml @@ -110,21 +110,28 @@

When you have a httpd built with mod_http2 you need some basic configuration for it becoming active. The first thing, as with every httpd module, is that you need to load it:

+ LoadModule http2_module modules/mod_http2.so +

The second directive you need to add to your server configuration is

+ Protocols h2 http/1.1 +

This allows h2, the secure variant, to be the preferred protocol on your server connections. When you want to enable all HTTP/2 variants, you simply write:

+ Protocols h2 h2c http/1.1 +

Depending on where you put this directive, it affects all connections or just the ones to a certain virtual host. You can nest it, as in:

+ Protocols http/1.1 <VirtualHost ...> @@ -132,6 +139,7 @@ Protocols http/1.1 Protocols h2 http/1.1 </VirtualHost> +

This allows only HTTP/1 on connections, except SSL connections to test.example.org which offer HTTP/2.

@@ -147,22 +155,28 @@ Protocols http/1.1

The order of protocols mentioned is also relevant. By default, the first one is the most preferred protocol. When a client offers multiple choices, the one most to the left is selected. In

+ Protocols http/1.1 h2 +

the most preferred protocol is HTTP/1 and it will always be selected unless a client only supports h2. Since we want to talk HTTP/2 to clients that support it, the better order is

+ Protocols h2 h2c http/1.1 +

There is one more thing to ordering: the client has its own preferences, too. If you want, you can configure your server to select the protocol most preferred by the client:

+ ProtocolsHonorOrder Off +

makes the order you wrote the Protocols irrelevant and only the client's ordering will decide.

A last thing: the protocols you configure are not checked for correctness @@ -210,12 +224,14 @@ ProtocolsHonorOrder Off Useful tools to debug HTTP/2

The first tool to mention is of course curl. Please make sure that your version supports HTTP/2 checking its Features:

+ $ curl -V curl 7.45.0 (x86_64-apple-darwin15.0.0) libcurl/7.45.0 OpenSSL/1.0.2d zlib/1.2.8 nghttp2/1.3.4 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 [...] Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 + macOS Homebrew notes

Homebrew's curl includes HTTP/2 support by default. Install with brew install curl and follow the displayed caveats to put it ahead @@ -260,27 +276,35 @@ ProtocolsHonorOrder Off with it in Apache httpd?

mod_http2 inspects response headers for Link headers in a certain format:

+ Link </xxx.css>;rel=preload, </xxx.js>; rel=preload +

If the connection supports PUSH, these two resources will be sent to the client. As a web developer, you may set these headers either directly in your application response or you configure the server via

+ <Location /xxx.html> Header add Link "</xxx.css>;rel=preload" Header add Link "</xxx.js>;rel=preload" </Location> +

If you want to use preload links without triggering a PUSH, you can use the nopush parameter, as in

+ Link </xxx.css>;rel=preload;nopush +

or you may disable PUSHes for your server entirely with the directive

+ H2Push Off +

And there is more:

The module will keep a diary of what has been PUSHed for each connection (hashes of URLs, basically) and will not PUSH the same resource twice. When @@ -317,18 +341,22 @@ H2Push Off client before the response is even ready. This uses the HTTP feature called "Early Hints" and is described in 8297.

In order to use this, you need to explicitly enable it on the server via

+ H2EarlyHints on +

(It is not enabled by default since some older browser tripped on such responses.)

If this feature is on, you can use the directive H2PushResource to trigger early hints and resource PUSHes:

+ <Location /xxx.html> H2PushResource /xxx.css H2PushResource /xxx.js </Location> +

This will send out a "103 Early Hints" response to a client as soon as the server starts processing the request. This may be much earlier than the time the first response headers have been determined, depending on your web