apachegoogle-chromehttp2pagespeed

Pages are served with HTTP/1.1 in browser and HTTP/2 in CURL


I installed HTTP/2 on a local Apache server, running on Ubuntu.

HTTP/2 is working, as it manages to upgrade the protocol when I do CURL on a page:

$ /usr/bin/curl -I --http2 http://test.local/public/
/usr/bin/curl: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/curl)
HTTP/1.1 101 Switching Protocols
Upgrade: h2c
Connection: Upgrade

HTTP/2 200 
...

Accessing the page from the browser, it still seems to be served as HTTP/1.1: enter image description here

I would like HTTP/2 to work when served through the browser.

What am I missing here?

I've tried restarting my computer and Chromium, Chrome, FireFox and Brave without seeing it in HTTP/2. I've tried on WP, Symfony apps and simple HTML/CSS pages.


Solution

  • It turns out the browser requires HTTPS / SSL for HTTP/2 to work, while CURL doesn't.

    Once I installed a local certificate and served the page over HTTPS, I got HTTP/2 in the browser and with CURL.

    See: Why do browser implementations of HTTP/2 require TLS?