h2c. Enabling HTTP/2 on the origin therefore does not improve the CDN-to-origin connection; it benefits clients and other services that connect directly to the origin with HTTP/2.
For direct HTTP/2 over TLS, the origin needs its own HTTPS configuration, certificate, and ALPN-capable TLS stack. The CDN resource certificate covers only the client-to-CDN connection and does not configure HTTPS or ALPN on the origin.
Nginx configuration
Nginx 1.9.5 or later with the HTTP/2 module is required.-
Open the HTTPS
serverblock in the Nginx configuration (often/etc/nginx/nginx.confor a file under/etc/nginx/sites-available/). -
Enable HTTP/2 with the syntax for the installed version.
For Nginx 1.25.1 and later, use:
For Nginx 1.9.5 through 1.25.0, use:For cleartext
h2con Nginx 1.25.1 and later, use:For cleartexth2con Nginx 1.9.5 through 1.25.0, use:Nginx does not negotiateh2cthrough an HTTP/1.1 Upgrade request, so clients must start HTTP/2 with prior knowledge. In versions before 1.25.1, anh2csocket accepts only HTTP/2; assign a dedicated port if HTTP/1.x clients must remain supported. Starting with version 1.25.1, the socket detects the HTTP/2 connection preface and otherwise uses HTTP/1.x. -
Test and reload Nginx:
Apache configuration
Apache 2.4.17 or later is required. HTTP/2 over TLS also requires an ALPN-capable TLS library.-
Enable the
mod_http2module (also known asmod_h2). -
Add the matching
Protocolsline to the virtual host configuration: -
Check the configuration:
-
If the check returns
Syntax OK, reload or restart Apache with the command for the operating system. On systems that use theapache2systemd service, run:
Origin verification
Test the origin directly after enabling HTTP/2. For HTTP/2 over TLS, run:HTTP/2. This test uses the origin hostname and certificate, not the CDN custom domain or CDN resource certificate.
If the origin supports cleartext h2c, test it separately:
HTTP/2.