How To Use Google PageSpeed Service With CloudFlare

The Google PageSpeed Service (PSS) is one of the best CDN services as well as website optimization service. Unlike other content delivery (CND) network, it provide wide verity of optimization features. Some of them are combine JavaScript and CSS, re-compress images, progressive images, lazy load images, inline CSS, JS and much more. Apart from that Google has wide range of server location around the world. However, it doesn’t have security features.

CloudFlare (CF) is another good CDN, web optimizer and security service. Although, Page Speed service has more web optimization features than the CF. Therefore, if you are like to use both of these features it’s possible. However, after configured the PSS, CloudFlare only gives protect from a wide range of online threats.

In order to use the  Page Speed beta service, the site’s domain WWW, CNAME should point to the PSS server. Normally, once we pointed the DNS records CNAME, CF gives Error 1000 DNS pointed to prohibit IP address error. Once properly completed the configuration procedure that error fix. And can continue both services.

CloudFlare DNS error

The main reason for above warning is you have enabled CF security for root domain name and www domain name. Once it correctly configured this error fix.

 

How to Use Google PageSpeed Service with CloudFlare.

 

  • Go to your domain name DNS settings.
  • First disable CloudFlare for root domain A” record. For an example digitalreborn.com A record. Later we need to re-enable it.
  • If your DNS records doesn’t have “CNAME” record for “WWW” domain (WWW has A record) you have to add a “CNAME” and delete that “WWW” DNS “A” record.
  • Then pointed “WWW” domain name (eg: – www.digitalreborn.com) to pagespeed given DNS value (eg: – pagespeed.googlehosted.com) and disable cloudflare for that DNS record  name.

PageSpeed service Served By Google

  • Add a new “A” record for origin sub domain and disable cloudflare. For an example origin.digitalreborn.com. When you go to the origin domain name, it’s not necessary to display the site. This domain uses for identifying the web server IP address.

PSS Hosted By You

  • Save the DNS changes and wait a bit. Go to the https://www.whatsmydns.net/ and check the “CNAME” and “A” records are propagated.

  • Now go back to the PageSpeed Service dashboard and check its status. If it displays Enabled, you have done.
  • Change the “Hosted By You” to newly added sub domain “A” record. For an instance origin.digitalreborn.com
  • Go to the site and check everything working as expected.
  • If everything is working normally go to the CloudFlare DNS setting and enable cloudflare for the root domain. For an example digitalreborn.com.
  • If it again displays Error 1000 DNS pointed to prohibited IP address and disable CloudFlare for the root domain and again after 5 or 10 minutes enable it.

Once you configured PSS, it really improves the page loading time and pagespeed insight ranking. But the site YSlow ranking can be changed (most of the cases it reduce). Because Google uses “googleusercontent.com” domain name to serve CSS and JavaScript. CF support document mentioned how to add a CNAME for Google PageSpeed (here), but in my situation it’s not work. After I followed above steps, it works fine for my WordPress site.