mod_http3 adds support for the HTTP/3 protocol (RFC 9114) running over the QUIC transport protocol (RFC 9000) to the Apache HTTP Server.
HTTP/3 runs over UDP rather than TCP and integrates TLS 1.3 encryption natively inside QUIC, eliminating TCP head-of-line blocking and providing faster connection establishment (0-RTT / 1-RTT).
Experimental Notice:
mod_http3is currently experimental and intended for testing and development. Do not use it in production yet.
mod_http3 relies on:
libngtcp2_crypto_ossl): Handles the QUIC transport.--with-http3-quic=openssl, it also handles the QUIC transport and ngtcp2 is not needed.Install OpenSSL, libnghttp3 and libngtcp2 with libngtcp2_crypto_ossl.
To build mod_http3, add --enable-http3 to your httpd ./configure command:
./configure --enable-ssl --enable-http2 --enable-http3 [other options...]
If libnghttp3 or libngtcp2 is installed in a non-standard location:
./configure --enable-http3 --with-nghttp3=/path/to/nghttp3 --with-ngtcp2=/path/to/ngtcp2 [other options...]
If pkg-config is available on your system, libnghttp3.pc will be automatically detected via PKG_CONFIG_PATH.
To enable HTTP/3 alongside HTTP/2 and HTTP/1.1:
LoadModule ssl_module modules/mod_ssl.so LoadModule http3_module modules/mod_http3.so # Listen on both TCP (for HTTPS/Alt-Svc) and UDP (for QUIC) Listen 4433 https <VirtualHost *:4433> ServerName example.com SSLEngine on SSLCertificateFile conf/server.crt SSLCertificateKeyFile conf/server.key # Enable HTTP/3, HTTP/2, and HTTP/1.1 Protocols h3 h2 http/1.1 DocumentRoot /var/www/html </VirtualHost>
Alt-SvcBecause HTTP/3 runs over UDP, web browsers typically connect via TCP (HTTP/1.1 or HTTP/2) first. mod_http3 automatically injects the Alt-Svc header into responses:
Alt-Svc: h3=":4433"; ma=86400; persist=1
Browsers caching this header will switch to HTTP/3 over QUIC on subsequent requests.
| Directive | Default | Context | Description |
|---|---|---|---|
H3Port | Server Port | server config, virtual host | UDP port to listen on for QUIC/HTTP-3. |
H3AltSvc | on | server config, virtual host | Advertise HTTP/3 support via the Alt-Svc response header. |
H3AltSvcMaxAge | 86400 | server config, virtual host | max-age in seconds for the Alt-Svc header advertisement. |
H3MaxConnections | 256 | server config | Maximum concurrent QUIC/HTTP-3 connections per child process. |
H3MaxConcurrentStreams | 100 | server config, virtual host | Maximum concurrent active streams per connection. |
H3StreamBufferSize | 65536 | server config, virtual host | Per-stream request and streaming-response buffer size (bytes). |
H3MaxRequestBodySize | 10485760 (10MB) | server config, virtual host | Maximum request body size buffered in memory (bytes). |
H3MaxResponseBodySize | 0 (unlimited) | server config, virtual host | Maximum response body size for whole-response buffering. |
H3HandshakeTimeout | 10 | server config | Timeout in seconds for QUIC TLS handshakes. |
H3IdleTimeout | 300 | server config | Idle timeout in seconds before closing inactive QUIC connections. |
H3StreamTimeout | Server Timeout | server config, virtual host | Timeout in seconds without progress before aborting a stream. |
H3AddressValidation | on | server config | Validate client addresses using QUIC Retry packets before accept. |
H3SessionTickets | on | server config | Issue TLS 1.3 session tickets for 0-RTT/fast connection resumption. |
H3SocketBufferSize | 2097152 (2MB) | server config | Socket send and receive buffer sizes for the UDP listener. |
H3MaxStreamErrors | 8 | server config, virtual host | Stream errors allowed before terminating connection with H3_EXCESSIVE_LOAD. |
H3QpackTableCapacity | 4096 | server config, virtual host | QPACK dynamic table capacity in bytes (0 disables dynamic table). |
H3QpackBlockedStreams | 0 | server config, virtual host | Allowed QPACK blocked streams count. |
H3MinWorkers | 16 | server config | Minimum request worker threads per child process. |
H3MaxWorkers | 64 | server config | Maximum request worker threads per child process. |
H3MaxWorkerIdleSeconds | 600 | server config | Seconds an idle worker thread is kept before termination. |
You can inspect HTTP/3 runtime status by enabling the http3-status handler:
<Location /http3-status> SetHandler http3-status Require local </Location>
curl (with HTTP/3 support)# Direct HTTP/3 connection curl --http3 -v https://localhost:4433/ # Test Alt-Svc upgrade curl --alt-svc /tmp/altsvc.cache -v https://localhost:4433/
--origin-to-force-quic-on=localhost:4433 or ensure valid certificates and reload after receiving the Alt-Svc header.about:config (network.http.http3.enable = true).ListenCoresBucketsRatio, one child serves the port. With it, each child serves one SO_REUSEPORT socket per listener bucket. On other platforms, one child binds the port.QUIC_CONNECTION_MIGRATION.md).--with-http3-quic)Measured with h3bench (openssl-h3-examples), one run per transport on the same machine, so only compare numbers from the same run:
ngtcp2 holds 4000 idle connections with no errors at about 50% CPU. openssl uses about 4 times the CPU at 1000 connections, gets errors at 2000 and none connect at 4000.openssl serves about 30 to 60% more requests per second, with lower p50 and p99 latency (for example 32 connections of 32 streams: 875 against 577 rps, p50 1.5 s against 2.3 s).1x1): ngtcp2 answers in about 1 ms. openssl stalls (0.2 rps, p50 over 1 s); the cause is not found yet.1x1, so something outside the QUIC layer, probably the event loop or the worker threads, uses CPU it should not. Look at that before reading much into the throughput gap.ngtcp2 has 0-RTT, routing by connection ID across child processes and connection migration.Use ngtcp2 (the default) unless you need to avoid the ngtcp2 dependency.