To enable HTTP/2, you need to configure both hitch and Varnish.
Enable HTTP/2 in hitch by turning it on in the hitch configuration file.
# Enable to let clients negotiate HTTP/2 with ALPN. (default off)
alpn-protos = "h2, http/1.1"
Enable HTTP/2 in Varnish by passing -p feature=+http2
as a startup argument to Varnish in the varnishd command line.
Do this by updating the unit file’s Execstart=
as the unit file configuration tutorial describes.
Below is an example of having adding -p feature=+http2
to the varnishd defaults:
[Service]
ExecStart=/usr/sbin/varnishd -p feature=+http2 ...
If varnish is already running you can enable HTTP/2 on the CLI with varnishadm. Note this varnishadm method of enabling HTTP/2 will not survive a restart.
$ varnishadm param.set feature +http2
Check if HTTP/2 is enabled in Varnish by running on the CLI:
$ varnishadm param.show feature