Don’t forget to turn on HTTP/2 to speed up your site

December 16, 2017

Yesterday evening, I was taking an audit for my own site through Google Chrome, which is accessible via developer tools on the Audits tab. You can Perform an audit… and one of the pieces of feedback you get is as follows:

HTTP/2 offers many benefits over HTTP/1.1, including binary headers, multiplexing, and server push.

The notice then links to an information page about the fundamentals of HTTP/2 and why it makes your site load faster. There’s some significant benefits to turning this on, and it’s really easy to turn on when you have a somewhat recent version of nginx installed. For example, I had to the change the following lines:

listen 443 http2 default_server;
listen [::]:443 http2 default_server ipv6only=on;

Earlier, I did not have http2 on those two lines. Once you’ve made the changes, restarting nginx should be enough. Use a browser that supports HTTP/2 (like Chrome or Firefox) and yes, you’ve got nginx serving HTTP/2 content. You can verify this in your browser:

As you can see, Google Chrome clearly indicates the HTTP/2 protocol in the Network request list.

It’s a super easy change to make, so I’d recommend taking care of this.