What Is HTTP/2 Server Push?

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.

Server push diagram

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.

Enabling Server Push

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.

Choosing What to 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:

  • Required Assets – The most obvious candidates for Server Push are all of the CSS, JavaScript, and image assets required by a web page.
  • Uncacheable Assets – Pushing dynamic assets means that they’ll get to the browser that much faster, reducing perceived page load time.
  • Likely Next Pages – By pushing the next page that a user is likely to load (e.g., the link they’re hovering over), Server Push can make it look like it loads instantaneously.
  • Redirects – It’s also possible to push arbitrary redirects. This lets you control the user’s browser cache.

Setting Up Cloudflare Is Easy

Set up a domain in less than 5 minutes. Keep your hosting provider. No code changes required.

Cloudflare Pricing

Everyone’s Internet application can benefit from using Cloudflare.
Pick a plan that fits your needs.

Free $ 0 /month per website
Expand to see more
For personal websites, blogs, and anyone who wants to explore Cloudflare.

Learn More

The Free Plan includes all of these features:
  • Unmetered Mitigation of DDoS
  • Global CDN
  • Shared SSL certificate
  • Access to account Audit Logs
  • 3 page rules
Compare all features
PRO $ 20 /month per website
Expand to see more
For professional websites, blogs, and portfolios requiring basic security and performance.

Learn More

The Pro Plan includes everything in Free, and:
  • Web application firewall (WAF) with Cloudflare rulesets
  • Image optimizations with Polish™
  • Mobile optimizations with Mirage™
  • I'm Under Attack™ mode
  • Access to account Audit Logs
  • 20 page rules
Compare all features
BUSINESS $ 200 /month per website
Expand to see more
For small eCommerce websites and businesses requiring advanced security and performance, PCI compliance, and prioritized email support.

Learn More

The Business Plan includes everything in Pro, and:
  • Web application firewall (WAF) with 25 custom rulesets
  • Custom SSL certificate upload
  • PCI compliance thanks to Modern TLS Only mode and WAF
  • Bypass Cache on Cookie
  • Accelerate delivery of dynamic content with Railgun™
  • Prioritized email support
  • Access to account Audit Logs
  • 50 page rules
Compare all features
Enterprise contact us
Expand to see more
For companies requiring enterprise-grade security and performance, prioritized 24/7/365 phone, email, or chat support, and guaranteed uptime.

Learn More

The Enterprise Plan everything in Business, and:
  • 24/7/365 enterprise-grade phone, email, and chat support
  • 100% uptime guarantee with 25x reimbursement SLA
  • Enterprise-grade DDoS protection with network prioritization
  • Advanced web application firewall (WAF) with unlimited custom rulesets
  • Multiuser role-based account access
  • Multiple custom SSL certificate uploads
  • Access to Raw Logs
  • Access to account Audit Logs
  • Dedicated solution and customer success engineers
  • Access to China CDN data centers (Additional Cost)
  • 100 page rules
Compare all features

Free

$ 0 / month
 
For personal websites, blogs, and anyone who wants to explore Cloudflare.

Pro

$ 20 / month
per domain
For professional websites, blogs, and portfolios requiring basic security and performance.

Business

$ 200 / month
per domain
For small eCommerce websites and businesses requiring advanced security and performance, PCI compliance, and prioritized email support.

Enterprise

Contact Us
 
For companies requiring enterprise-grade security and performance, prioritized 24/7/365 phone, email, or chat support, and guaranteed uptime.