• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » HTTP/2 Server Push : Nginx & WordPress

By Abhishek Ghosh November 29, 2016 1:16 pm Updated on November 29, 2016

HTTP/2 Server Push : Nginx & WordPress

Advertisement

Here is a Clear, Easy Guide on HTTP/2 Server Push. Nginx & WordPress is Commonly used Combination For HTTPS on Cloud to Dedicated Servers. We need to clarify some matters which are probably not clear. HTTP/2 Server Push Nginx has been more a buzzword than real guides and usage. It is CloudFlare who has support. Unless RFC is followed, other resources will not work :

Vim
1
2
3
https://tools.ietf.org/html/rfc7540
https://http2.github.io/http2-spec/
https://w3c.github.io/preload/#server-push-http-2

Nginx community edition does not support HTTP/2 Server Push as server software. Nginx Plus paid does support HTTP/2 Server Push as server software. H2O server cum reverse proxy, Apache2 supports HTTP/2 Push. CloudFlare service does support HTTP/2 Server Push as reverse proxy service. In other words, if you are using Nginx community edition, then after following the guide you have pass through CloudFlare service to get HTTP/2 Server Push. We do not recommend that for production server. As we normally do not use CloudFlare, but standard DNS like Dyn DNS. You can test how it feels on dev server. We are first configuring Nginx & WordPress for HTTP/2 Server Push.

 

Needed Setup For Testing HTTP/2 Server Push With Nginx & WordPress

 

Normal Nginx WordPress setup with Let’s Encrypt or any SSL certificate. Please search our website using the search function in case you need something.

Advertisement

---

 

How to Test HTTP/2 Server Push With Nginx & WordPress

 

You can follow our guide and test with Google Chrome’s Console tool. If you pass through CloudFlare DNS, it will show the resources as “Push”. , Nginx community edition is going towards scrap. On Chrome browser, click options in this manner :

Vim
1
2
View > Developer > Javascript Console > Network
(right click on console's name option to get option menu)

Click to tick these options on the context menu you got by right click :

Vim
1
Method, Status, Protocol, Scheme, Initiator

Now test some website which has like :

Vim
1
2
https://blog.cloudflare.com/
https://www.shimmercat.com/

Under Initiator column of Chrome’s Javascript Console you’ll see that there are “Push”, like this entry :

Vim
1
screen.css?v=7f0b850bacGET200h2httpsPush / (index):16

You’ll see that only blue coloured bar is present. If you click on it, you’ll get a menu with context box where clearly written “Receiving Push”. Check their header with cURL (or cURL for Windows) :

Vim
1
2
curl -I -s https://blog.cloudflare.com/ | grep link
link: </assets/css/screen.css?v=7f0b850bac>; rel=preload; as=style,<//cdn.bizible.com/scripts/bizible.js>; rel=preload; as=script,<https://code.jquery.com/jquery-1.11.3.min.js>; rel=preload; as=script,<//fast.eager.io/CGVfxD1y6q.js>; rel=preload; as=script,</assets/js/jquery.fitvids.js?v=7f0b850bac>; rel=preload; as=script

This is a screenshot illustrating push on console :

http-2-server-push-nginx-wordpress

 

How to Setup Nginx For HTTP/2 Server Push

 

It does not matter whether you are using free Nginx or paid Nginx. This is mandatory step. Upon cURL, you have to receive this stuffs which you want to push :

Vim
1
2
link: </wp-includes/js/jquery/jquery.js>; rel=preload; as=script
link: </wp-includes/js/jquery/jquery-migrate.min.js>; rel=preload; as=script

You can join multiple if you want like example header of cURL. Edit the “virtual hosts” file under /etc/nginx/sites-available directory (in case of Ubuntu, Debian), which is normally named as default and normally add the directive under server block in the way you add various headers. This is a set of example :

Vim
1
2
3
add_header link "</wp-includes/js/jquery/jquery.js>; rel=preload; as=script";
add_header link "</wp-content/themes/example/style.css>; rel=preload; as=style";
add_header link "</wp-content/uploads/this/image.jpg>; rel=preload; as=image";

After adding, run nginx -t and restart nguni with sudo service nginx restart command. Clear caches of your website and perform cURL to check header.

 

How to Setup WordPress For HTTP/2 Server Push

 

Obviously, you may need to test within WordPress instead of always testing with editing Nginx config. Both together (Nginx and WordPress) not needed. If your web server support push, then you can use PHP to add header or WordPress Plugin to add header response like “Add Headers” plugin (on WordPress repo). If you use PHP then this will be the syntax :

Vim
1
<?php header('link: </wp-content/themes/example/style.css>; rel=preload; as=style'); ?>

WordPress does have function to add header :

Vim
1
2
3
4
add_action( 'send_headers', 'add_header_push' );
function add_header_push() {
header( 'link: </wp-includes/js/jquery/jquery.js>; rel=preload; as=script' );
}

Tagged With paperuri:(40eb0f61d7ef8cc927d5d72ae3bd7b56) , nginx http2 push , http/2 push wordpress , http2 push wp , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1821 24j_2Jd9U22C94zwHuuhSggGGUMv-2sj1hgTMsJsEkN8XUX3AEaDh2v3svFxRO3W 11b4afee85655ce4f8b257af9c2b12eae67edb14&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , nginx http 2 push
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to HTTP/2 Server Push : Nginx & WordPress

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud

    Here is a Step by Step Guide on Setting Up WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud with All Commands and the Configuration.

  • Cache Aware HTTP/2 Server Push On Apache2, WordPress

    Here Is Cache Aware HTTP/2 Server Push On Apache2, WordPress (Not Preload) Which Can Make Your Webpage To Load Faster Over HTTP/2 With Plan.

  • How to Install WordPress : Ubuntu 16.04, Nginx, PHP7-FPM

    Here is Step by Step Guide on How to Install WordPress on Ubuntu 16.04, Nginx, PHP7-FPM, memcached & Percona MySQL 5.7 on Cloud Server or VPS.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy