That's the idea that led to implementing server push. Lots of people it, and it turns out not to work very well. There's too much variation in what people will already have in their caches and the server is not great at predicting the order in which clients will need the resources.
Re:Removing HTTP/2 Server Push from Chrome
by vbezhenar on Friday August 19, 2022 @02:13PM
(#32524363)
Client can send bloom filter with first request.
Re:Removing HTTP/2 Server Push from Chrome
by habibur on Friday August 19, 2022 @02:50PM
(#32524721)
How? The client needs to know what the resources are to create a bloom filter. It doesn't know that before 1st request.
Re:Removing HTTP/2 Server Push from Chrome
by vbezhenar on Friday August 19, 2022 @05:02PM
(#32525865)
First request is empty filter, server will push everything mentioned in HTML. For subsequent requests browser will fill filter with known hashes, server will push changed resources (and false positives).
Re:Removing HTTP/2 Server Push from Chrome
by mort96 on Saturday August 20, 2022 @04:33AM
(#32530389)
But for subsequent requests the content is cached.
your browser can have a bloom filter for each subdomain.
I'm just still shocked that this wasn't obvious to more people before: it isn't like you even need to have implemented this feature to do the instrumentation required to know whether this would work, and it frankly had always seemed like a long shot.
I think it was something much simpler: oh, you're navigating to `index.html` without session? You're going to need this CSS, JS and PNG files as well.
And the idea is that client would already have those files by the time browsers parses `<head>` it already has them all. Except...browser cache exists, so who cares.
Re:Removing HTTP/2 Server Push from Chrome
by mmis1000 on Friday August 19, 2022 @02:40PM
(#32524613)
Ans it turns out the way this was implemented didn't really works well. There just isn't a universal format that you can generate the list and upload it to server/cdn/whatever. No one ever figure out how to actually use this list to generate a http2 server push from a common platform/cdn.
The alternative (Service worker/<meta> preferch/preload tags) on other hand are much easier to handle although have one extra round trip. Because they are just text files that you need to upload to the server.
1) Load page through javascript-enabled browser (headless chrome, etc), and record resources accessed from the same server;
2) Save this list somewhere, where server can read it, keyed by URL;
3) When user requests same URL, push resources from the list.