Browser-side suggested HTTP/2 server push

2019-08-04 01:22发布

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)?

2条回答
不美不萌又怎样
2楼-- · 2019-08-04 02:23

The objective of server push is that the server send additional files (e.g. javascripts, css) along with the requested URL (e.g. an HTML page) to the browser before the browser knows what related files are required, thus saving a round-trip and improve webpage load speed. If the browser already know what resources are needed it can request with normal HTTP calls.

查看更多
Melony?
3楼-- · 2019-08-04 02:27

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.

查看更多
登录 后发表回答