Search code examples
httprequesthttp2

Browser-side suggested HTTP/2 server push


Are there any specific spec'd processes that a browser client can use to dynamically encourage a server to push additional requested items into the browser cache using HTTP/2 server push before the client needs to actually use them (not talking about server-side events or WebSockets, here, btw, but rather HTTP/2 server push)?


Solution

  • There is nothing (yet) specified formally for browsers to ask a server to push resources.

    A browser could figure out what secondary resources needs to render a primary resource, and may send this information to the server opportunistically on a subsequent request with a HTTP header, but as I said, this is not specified yet.

    [Disclaimer, I am the Jetty HTTP/2 maintainer] Servers, on the other hand, may learn about resources that browsers ask, and may build a cache of correlated resources that they can push to clients.

    Jetty provides a configurable PushCacheFilter that implements the strategy above, and implemented a HTTP/2 Push Demo.