How much of HTTP/2 works out of the box?

I've been looking a bit into HTTP/2, and I believe it could help improve the performance on the systems I'm working with, but I got some questions regarding how it's actually implemented, and regarding backwards incompatibility

HTTP/2 Allows fetching multiple assets from one established connection. Do browsers automatically know what should be fetched from one connection based on the domain, or do you need to tell them specifically? How long is this connection generally open, I mean, if I have some AJAX calls that runs when the page loads, will they be able to reuse the same connection?

How does web servers handle browsers that does not support HTTP/2? Do they negotiate with the browser and fall back to HTTP/1, and is this default behaviour, or does it depend on the server's configuration?

How does browser caching work with HTTP pushing assets from the server? Does the server start with the cache headers and stop if the browser has the item cached? or is the entire thing just pushed every time?

Lars Graubner's photo

I'm not an expert, but my experience is it just works and can be used today. Older browsers which do not support HTTP 2 just fallback to HTTP 1.

Fetching assets from an established connection happens automatically. If I'm correct you can't even control it. But this way you can only benefit from it.

HTTP push seems to be hard to be implemented as of now. Maybe this will improve in the future. You can read more about issues here.

I'd say just go for it. There is nothing to loose and you will get immediate benefits.

J03's photo

I love that IM conversation explanation. That's exactly of how I envisioned HTTP/2 before seeing that.

Jesper Jarlskov's photo

Thanks a lot. You've substantiated my understanding of how it would work, so I really appreciate that.

HTTP push was mostly out of interest, we're not going to start looking into that yet, but I believe the reusable connections for fetching assets could be a nice bonus in our current setup.

I've contacted our hosts to hear about our current options for upgrading :-)

Ben Buchanan (200ok)'s photo

When I converted my personal sites, the main gotchas came from needing to use https along with http2. I had to go through all the templates etc finding http links and changing to https or no-protocol format links; etc.

The actual http2 bit was basically turn-key with my hosting company. From what I understand, browsers that don't understand http2 just get http1.

From memory I got ~20% speed boost for doing nothing more than enabling http2.

Jesper Jarlskov's photo

For many reasons I believe it's bad practice to run anything these days, so that's not an issue :-)

I've converted a few of my personal sites to HTTP/2 with great success, but this project has some larger requirements to availability, so I wanted to make sure I wasn't forcing anybody off the system by upgrading.

But my host apparently doesn't support HTTP/2, since it's not available on CentOS 7, so that pretty much made the final decision for me, sadly :-(.