Server Push is a feature of HTTP/2 that allows a server or edge
network to send resources back to a web browser even though it
didn’t ask for them. Cloudflare supports HTTP/2 Server Push for all
customers on our network.
HTTP/2 Server Push is a modern, more efficient equivalent to the common
practice of inlining assets in HTTP/1.1. Inlining is when you convert your
<style> elements in your HTML page. The goal is to minimize
the number of HTTP requests between the browser and the server. Server Push
accomplishes the same thing, but allows assets to be cached independently so
that you’re not sending the same inline CSS styles with every single web page
your visitors request.
Cloudflare supports HTTP/2 Server Push via the Link header.
To make use of Server Push, most applications will need to change
their code to include a Link header with any requests that
have pushable assets.
For example, if you have a web page called page.html that requires
/css/style.css, you need to add the following header to page.html:
Link: </css/style.css>; rel=preload;
This tells our edge network to begin pushing /css/style.css
every time a visitor asks for page.html. If style.css is already
in the local browser cache, the browser will ignore the push and
cancel the download. Otherwise, when it discovers /css/style.css
while rendering the HTML, the browser will use the pushed asset
instead of going back to the server. This removes an unnecessary
round-trip that would have occurred without Server Push.
Server Push is a fundamental change to HTTP. Web servers used to only
be able to respond to requests from clients, but now they can actively
push out content to browsers. This opens the door to several new types
of web optimization. Some of the most common use cases:
Set up a domain in less than 5 minutes. Keep your hosting provider.
No code changes required.
Everyone’s Internet application can benefit from using Cloudflare.
Pick a plan that fits your needs.
for personal websites and blogs
Our mission is to build a better Internet. We believe every website should have free access to foundational security and performance. Cloudflare's Free plan has no limit on the amount of bandwidth your visitors use or websites you add.
If you want to make your site even faster and more resilient, you can easily upgrade to one of our higher tier plans.
为了在我们的网站上为您提供所能达到的最佳体验，我们可能使用 cookie，如此处所述。通过单击“接受”、关闭此横幅或继续浏览我们的网站，即表示您同意使用此类 cookie。