HTTP/2 push doesn't work

I’m trying to make HTTP/2 push work with Cloudflare and I’m struggling. I followed exactly this example /workers/examples/http2-server-push/ and it works fine with my free personal account. I can see in Chrome dev tools network tab that the initiator is “Push” and cf-h2-pushed header as well as I see PUSH_PROMISE when using nghttp.

When I try to do the same with another paid Cloudflare account (HTTP/2 is enabled), it doesn’t work at all.

Does anyone has any idea?

Sorry to inform you, but HTTP/2 Push is deprecated and no longer used. See:

Chromium and other browsers are not supporting it anymore, so even if you want it to work and Cloudflare would support it (which they don’t), then it would not work, because the browser does not support it anymore and therefore no client would be able to profit from.

But the good news is: there are “Early Hints”. Early Hints are the “replacement” for HTTP/2 Push & HTTP/3 Push. Early Hints are not as performant as HTTP Pushes, but are at least giving you a somewhat same experience.

There the blogpost from Cloudflare: Early Hints: How Cloudflare Can Improve Website Load Times by 30%

The good part is: Early Hints are implemented the same way as HTTP/2 Push - over the link header.

Yes, this is a little mislabeled I would say, should have been named something with “EarlyHints”. Like mentioned before, the implementation header-wise is the same. But ofc this now will implement EarlyHints, not a HTTP/2 Push.

If you like to know how to check if EarlyHints are working, please check this post #342888/#12

Or use the tool I build and mentioned here: #342888/#17
Just paste the URL you want to check against and run it several times. If it once returns positiv, then it is active.

2 Likes

Thank you very much for the quick answer!

Well, I read about Google’s intention to stop supporting it in Chrome but I was a bit skeptical since I was able to make HTTP/2 push work with Cloudflare + Chrome like 1 hour ago (again, only with my personal free Cloudflare account).

I’ll consider “Early Hints”, I wasn’t aware of it, thanks for the tip.

Have a nice day!

Would you elaborate, how you checked that HTTP/2 Push was working? What browser & version are you using?

You’re welcome!

Chrome: 103.0.5060.134

I just tested it again.

Just tested - also works for me, but 100% sure I read, that the support for this was removed… now I have to do some research!
When they discontinued it, it was not working for me for quite a while, never tested it since then.

So, I’m very confused with it. This is what I can see:

Besides that, I only read about the “intention” to remove, I couldn’t see any reference to “it’s already deprecated”. For it sounds my like some Cloudflare issue because when I use nghttp I can see PUSH_PROMISE but if I do the same to the other website (paid account), I can’t see it (and they have the exact same configuration). So it seems like Chrome is not showing the “Push” because Cloudflare is not actually pushing the content.

It was decided for HTTP/2 Server Push not to be removed until a working implementation of Early Hints was available.

Now that it is, I’d expect to see Server Push removed very soon, and as per this discussion thread, it’s likely we may even see this in the next Chrome Canary:

https://groups.google.com/a/chromium.org/g/blink-dev/c/K3rYLvmQUBY/m/0o4J1GEjAgAJ

Generally though, it’s a feature that was often misused and resulted in worse performance for users. So as others have suggested, I’d recommend looking at early hints instead.

2 Likes

Just out of curiosity, can you test copying all files you want to push into the directory /http2_push/h2p/ and push them with their new link from here?

As the page you successfully could push served them from there and Cloudflare sometimes does have special directories. For example for hotlinking, where the directory, or directory name does apply certain functions.

If you want us to look into this, please provide a URL where it is implemented, but does not work.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.