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 external JavaScript and CSS resources into <script> and <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.
<script>
<style>
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.
Learn More
To provide you with the best possible experience on our website, we may use cookies, as described here.By clicking accept, closing this banner, or continuing to browse our websites, you consent to the use of such cookies.