A guide to setting up Cloudflare on your WordPress site

A guide to setting up Cloudflare on your WordPress site

What is Cloudflare and why use it?

Cloudflare sits between your web server and the rest of the internet and diverts web traffic to their network. Cloudflare will then divert traffic to their network instead of directly to the origin server.

Cloudflare can cache static web content and screen visitors to ensure that they are good rather than coming from an attack or a malicious bot. Because CloudFlare’s network comprises 32 global data centers, your clients can access your content very quickly no matter how far away your origin server is.

Should you consider Cloudflare or stick with NitroPack?

Cloudflare and NitroPack have distinctive advantages. Cloudflare focuses on speed and security, while NitroPack focuses on speed. Specifically, NitroPack provides a comprehensive page speed optimization service with caching, CDN, image optimization and script optimization, resulting in a 90+ Desktop PageSpeed Score.

Cloudflare protects against SQL injections and identity theft, among other things. Cloudflare improves site performance and speeds up page load times by using its global network of data centers. When your website visitor connects to CloudFlare’s network, they are redirected to the nearest server. Because of this, the closer the data center is to the user, the quicker your website loads (this is especially important for high-volume sites dependent on a global audience/readership pool).

Useful Cloudflare features for WordPress sites

Here’s a table of features that help with optimizing your WordPress site:

FeatureWhy it is useful
CDNThe quick transfer of assets required to load Internet content, such as HTML pages, javascript files, stylesheets, images and videos, is enabled by a CDN. CDN services are becoming increasingly popular, and CDNs are currently serving the majority of web traffic, including traffic from big names like Facebook, Netflix and Amazon.
SSLSSL encrypts internet connections to ensure information is safeguarded as it is transferred between systems. When you see a padlock icon next to the URL in the address bar, SSL is protecting the website you are visiting.

CloudFlare offers several modes when dealing with SSL/TLS encryption:

  1. Off: no encryption applied

  2. Flexible: encrypts traffic between the browser and CloudFlare

  3. Full: encrypts end-to-end, using a self signed certificate on the server

  4. Full (strict): encrypts end-to-end, but requires a trusted CA or CloudFlare Origin CA certificate on the server.

DNSAny online business relies on DNS to function. CloudFlare DNS is an enterprise-grade DNS service that provides the fastest response times, unrivalled redundancy, advanced security and built-in DDoS protection and DNSSEC. CloudFlare will replace and manage your existing DNS provider.
SecurityOffers security services to protect and secure web properties from denial-of-service attacks, customer data breaches and malicious bots.

CloudFlare offers a number of security tools:

  1. WAF: The CloudFlare WAF provides both automatic protection from vulnerabilities and the flexibility to create custom rules.

  2. Page Shield: allows you to see the scripts running on your zone as well as the outbound connections from your zone, helping you detect attacks occurring in your users' browsers.

  3. Bots: gives you advanced control over bots visiting your website.

DDoS protectionAutomatically detects and mitigates Distributed Denial of Service (DDoS) attacks using its Autonomous Edge. CloudFlare DDoS Protection Managed Rulesets expose multiple dynamic mitigation rules.
Image optimizationProvides a secure and efficient image delivery service using CloudFlare servers to store, resize, optimize and deliver images.

For example, before using the image optimization service, stock site CMSs typically do not support next gen images like WebP.

How Cloudflare helps with technical SEO

Quality content, user experience and not making things more difficult for search engine crawlers are all crucial to SEO in practice. Cloudflare features can improve Search Engine site rankings, but having meaningful and frequently updated site content is still crucial to improving SEO.

Cloudflare offers a number of features that when enabled can optimize site performance:

  1. Image Resizing: allows you to adapt images to your site’s layout and your visitors’ screen sizes without maintaining a server-side image processing pipeline.
  2. Polish:  optimizes images by converting them to more optimized formats such as WebP.
  3. Auto Minify: reduces the size of source code on your site such as JavaScript, CSS and HTML (see how to eliminate render-blocking resources). This will result in reducing the size of your resources and speeding up your website.
  4. Brotli: speeds up page load times by compressing content using the Brotli compression.
  5. Early Hints: having Crawler Hints on your website ensures that search engines and other bot-powered experiences have the most up-to-date version of your content, resulting in happier users and, in turn, influencing search rankings.
  6. Enhanced HTTP/2 Prioritization: optimizes the order of resource delivery, independent of the browser.
  7. TCP Turbo: reduces latency and increases throughput with custom-tuned TCP optimizations.
  8. Rocket Loader: improves the paint time for pages that include JavaScript.
  9. Automatic Signed Exchanges (SXGs): improves site performance by making cacheable resources available on Google’s Signed Exchanges.
  10. Prefetch URLs: CloudFlare will prefetch any URLs included in the prefetch HTTP header.

Steps to set up Cloudflare on WordPress

Before getting started, visit Cloudflare and create an account.

Configure Cloudflare

  1. Login to Cloudflare
  2. Go to Websites
    CloudFlare Add Site
  3. Click Add Site and enter your domain and click Add site
    CloudFlare Add Site
  4. Select a plan and click Continue
    CloudFlare select a plan  
  5. Review your DNS records and click Continue
    CloudFlare review DNS records  
  6. Make note of the nameservers, they will be required when changing the nameservers in your domain provider
    CloudFlare nameservers
  7. Login to your domain provider, go to your domain’s DNS settings and locate nameservers
    GoDaddy nameservers
  8. Edit the nameservers and change them to the nameservers noted in step 6
    Change GoDaddy nameservers Changed GoDaddy nameservers
  9. Go back to Cloudflare and click on Check nameservers (Note that this step could take up to 24 hours to validate)
    CloudFlare check nameservers

Installing the WordPress plugin

To Configure WordPress to work with Cloudflare, you’ll first need to install the Cloudflare plugin.

  1. Log in to your WordPress dashboard
    WordPress login  
  2. Navigate to Plugins
    WordPress plugins screen
  3. Search for Cloudflare and click Install Now
    WordPress plugins search
  4. Click Activate
    WordPress activate installed plugin

Configure the Cloudflare plugin

  1. Open a browser and navigate to Cloudflare, login and go to API tokens under profile
    CloudFlare API tokens
  2. Click on the View next to the Global API Key, enter your password to reveal the key and make note of this key
    CloudFlare view API key
  3. Go to Settings and then Cloudflare
    WordPress CloudFlare plugin settings
  4. Click on Sign in here, enter your email and the Global API key and click Save API Credentials
    WordPress enter CloudFlare API key
  5. You are now connected to Cloudflare, click Apply recommended Cloudflare settings for WordPress
    WordPress CloudFlare settings

Cloudflare Automatic Platform Optimization for WordPress

Cloudflare’s edge network and caches third-party fonts for Automatic Platform Optimization for WordPress ensure optimum performance for your site. You don’t have to alter how you manage your website to gain the benefits of a static site. TTFB and content load faster as a result of consistent, fast content delivery.

To enable this feature:

  1. Log in to WordPress
  2. Go to Settings and then Cloudflare
  3. Scroll to Automatic Platform Optimization and turn it On
    WordPress CloudFlare automatic platform optimization

Cloudflare Argo and Railgun

Cloudflare offers two optimization features: Argo and Railgun.

  • Argo reduces bandwidth costs, improves reliability, and shortens page load times by taking advantage of CloudFlare’s optimized routes. Argo Smart Routing can be activated by enabling the feature, resulting in a 30% reduction in Internet latency and a 27% reduction in connection errors on average.
  • Railgun technology caches frequently accessed resources, ensuring that visitors to the site receive fast page loads. Railgun caches and accelerates uncacheable website content, ensuring that, even when the origin server must be accessed, visitors still receive fast page loads. It even works with dynamic webpages like news sites or personalized content.

Frequently asked questions

How does Cloudflare provide DDoS protection?

CloudFlare’s Autonomous Edge and centralized DDoS systems analyze traffic samples “out-of-path” to detect and mitigate DDoS attacks. Asynchronously detecting DDoS attacks without latency or performance issues is achieved by analyzing traffic samples “out-of-path.”

Cloudflare: is their free version enough?

For small hobby websites, the free plan is enough. It offers CloudFlare’s unmetered DDoS protection as well as some of the speed optimization features such as static content caching. However, for larger websites, it is recommended to upgrade to a paid plan, which provides access to a wider range of Cloudflare features such as image optimization.

Large businesses and enterprise users would benefit greatly from moving to a business or enterprise plan.

Can Cloudflare hurt a website’s SEO or Google Rankings?

Cloudflare can significantly improve the performance of your website if you choose to use it. It can also help improve your SEO efforts. It may, on the other hand, negatively impact your SEO if it is used improperly. You may experience issues with link checkers, time delays on fast servers or Cloudflare reporting your site as down, just to name a few. You may want to give Cloudflare a try if the benefits outweigh the negatives.

Jason Safavi

Jason Safavi is an experienced technologist with a passion for innovative software development. With over 18 years of experience in the field, he has established himself as an expert in advanced website builds and machine learning. As our company's Chief Technology Officer, Jason leads the development of cutting-edge software solutions that help drive business growth and improve our clients' experiences. He has an exceptional ability to identify new and emerging technologies and adapt them to meet our clients' evolving needs. Jason is a strong advocate of continuous learning and encourages his team to stay up-to-date with the latest trends and best practices in software development. He is always exploring new web and software technologies, experimenting with new programming languages, and testing new tools and frameworks to see how they can be used to improve our products and services. Aside from his passion for technology, Jason is also an avid gamer. He enjoys playing games on his PS5, and we often joke about him constantly losing in Mortal Kombat matches.

Get the latest blog updates from Productive Shop! Subscribe to our blog:

    Top