Cloudflare HTTP/2 progressively enhances your website’s performance. When a browser supports HTTP/2, our edge network will take full advantage of HTTP/2 performance benefits. For older browsers or non-HTTPS requests, we’ll fall back to HTTP/1.1. You don’t need to choose between better performance and backwards-compatibility.
HTTP/2 is automatically enabled for all accounts on any plan level, and requires no changes to your web server configuration.
Sign up now View a live demoHTTP/2 is the first upgrade to the Hypertext Transfer Protocol since 1999. It’s goal is to improve website performance by optimizing how HTTP is expressed “on-the-wire.” It doesn’t change the semantics of HTTP, which means header fields, status codes, and cookies work exactly the same way as in HTTP/1.1.
HTTP/2 began its life as Google’s SPDY protocol, which they designed to address many of the performance problems inherent in HTTP/1.1. The core benefits of SPDY have made their way into HTTP/2, improved by the global Internet community, and formalized into an Internet Standard.
HTTP/2 introduces several new features, and they’re all designed to improve page load times for your website visitors.
Multiplexing is perhaps the most significant benefit of HTTP/2. HTTP/1.1 requires each request to use its own TCP connection. Multiplexing, in contrast, allows a browser to include multiple requests in a single TCP connection.
The problem is, a browser can only have a limited number of TCP connections open at any given time. For HTTP/1.1, this means a browser can only load a single resource at a time—every asset in a web page is sent back to the browser sequentially. Multiplexing allows a browser to request all these assets in parallel. This results in a dramatic performance gain.
HTTP/1.1 is sort of like buying a single item at a grocery store, taking it back home, going back to the store for the next item you need, and repeating until your pantry is fully stocked. Multiplexing gives you a shopping cart so you can pick up everything you need in one trip.
Modern websites rely on a lot of external assets: images, CSS, JavaScript, and fonts, just to name a few. Each time a browser requests one of these assets, it includes an HTTP header with the request. When the server sends the asset back to the browser, it also includes an HTTP response header. That’s a lot of overhead for the typical web page.
HTTP/2 forces all HTTP headers to be sent in a compressed format, reducing the amount of information that needs to be exchanged between browser and server. HTTP/1.1 does not provide any form of header compression.
HTTP/2 Server Push lets our edge network send web assets back to your browser before it even knows it needs them. This speeds up page load times by eliminating unnecessary round trips. For example, when a browser requests an HTML page, you can “push” all of the CSS stylesheets, image resources, and other assets inside of that web page. After the browser parses the HTML and finds all those assets, they’ll already be loaded into the local browser cache. This avoids extra requests back to the server.
See more details about HTTP/2 Server Push.
Stream priority is a mechanism for browsers to specify which assets they would like to receive first. For example, an HTTP/2-aware browser can use stream priority to load the HTML for a page first, followed by CSS, then JavaScript, and finally image assets. This order allows the browser to render the page as quickly as possible.
You can think of stream priority as an optimization on top of multiplexing. Multiplexing lets you send several requests in a single TCP connection, and stream priority lets you define the order of the responses. While multiplexing eliminates much of the TCP overhead, it does nothing to optimize transfer times from the server to the browser. This is what stream priority is for.
You can serve your existing applications over HTTP/2 without any changes to the underlying code, but to take full advantage of all HTTP/2 has to offer, make sure you understand the impact that HTTP/2 will have on your website.
Much of the website optimization for HTTP/1.1 revolves around minimizing the number of TCP connections with the server. This results in practices like concatenating multiple CSS or JavaScript files into a single file, combining multiple image files into a single spritesheet, and spreading your website’s assets across multiple domains (sharding). Many of these techniques are no longer necessary in HTTP/2, and some of them can, in fact, hurt performance.
Concatenating files is no longer a best practice in HTTP/2. While concatenation can still improve compression ratios, it forces expensive cache invalidations. Even if only a single line of CSS is changed, browsers are forced to reload all of the assets. In HTTP/2, it’s better to ship granular resources and optimize how they’re cached.
Domain sharding should be avoided in HTTP/2. The goal of sharding is to maximize the amount of active TCP connections. However, each of these connections incur unnecessary overhead and compete with each other for bandwidth. Eliminating domain sharding also makes for simpler build and deployment processes, since all your assets can now live on a single server.
These are just a few optimizations to consideration when deciding if HTTP/2 is right for you.
HTTP/2 does not technically require an encrypted connection, but the majority of implementations only support HTTP/2 when used in conjunction with SSL/TLS. No browsers currently support HTTP/2 over an unencrypted connection. For practical purposes, this means that your website must be served over HTTPS to take advantage of HTTP/2.
If you’re not already serving your website over HTTPS, you can enable it for free with our Universal SSL offering.
HTTP/2 is available free of charge to all Cloudflare customers. HTTP/2 is automatically enabled for both Free and Pro accounts, and can be enabled with the click of a button for Business and Enterprise accounts.
Set up a domain in less than 5 minutes. Keep your hosting provider. No code changes required.
Everyone’s Internet application can benefit from using Cloudflare.
Pick a plan that fits your needs.