All Collections
Getting Started
Making Website Faster
How to Integrate Cloudflare With Your Application
How to Integrate Cloudflare With Your Application

A step-by-step guide [with images] on how you can integrate, manage, and configure Cloudflare with your application.

Cloudways Product avatar
Written by Cloudways Product
Updated over a week ago

Table of Contents

Application security and performance are Cloudways' top priorities. Therefore, we at Cloudways are constantly innovating, taking new measures, and partnering with industry leaders to improve the performance and security of the platform you trust.

In continuation of delivering excellence to you, we have partnered with Cloudflare to introduce the Cloudflare Enterprise add-on to leverage their cutting-edge technology, robust infrastructure, and advanced-level security — all within the Cloudways Platform.

In this article, you will learn how to integrate the Cloudflare Enterprise add-on with your websites in a few easy steps.

Cloudflare Enterprise Add-on Pricing

The Cloudflare Enterprise add-on pricing structure is straightforward. Each Cloudflare subscription is attached to a unique domain and offers volume discounts for professionals and agencies. Therefore, the more domains you have under the Cloudflare subscription, the cheaper it gets. Visit the pricing page to get more information.

Important

If you cancel your Cloudflare subscription on one domain and resubscribe it using the same domain, it will be counted as a separate subscription.

How to Integrate Cloudflare Enterprise Add-on

You can integrate the Cloudflare Enterprise add-on with existing and new websites. But, let's first understand the difference between both as further steps slightly vary.

Existing Websites vs New Websites

An existing website means that your website is live from Cloudways and uses your custom domain, e.g., example.com. On the other hand, a new website means that your website is not currently live from Cloudways. Therefore, you should first follow the take site live checklist and complete steps 1, 2, and 3. Once done, come back to this article and resume reading.

To integrate Cloudflare with your domain, you need to point it to the Cloudflare Enterprise Network using a CNAME record.

Log in to your Cloudways Platform using your credentials.

  1. From the top menu bar, open Servers.

  2. Next, choose the server where your desired application is deployed.

    Classic Interface

    New Interface

  3. Click www.

  4. Next, choose your application name.

    Classic Interface

    New Interface

  5. Under Application Management, select Cloudflare.

    Classic Interface

    New Interface

  6. Enter your domain name. Cloudflare Enterprise supports root domains and subdomains. You can enter a root domain (example.com) or a subdomain (support.example.com).

    Entering the root domain automatically covers the www domain, and it will be protected by Cloudflare Enterprise.

  7. Next, click Enable.

    Classic Interface

    New Interface

  8. Next, you must point your domain to your site's CNAME record using your DNS registrar panel. Click View CNAME Record to view more information.

    Classic Interface

    New Interface

  9. The process of adding DNS records varies across different DNS managers. We are using Namecheap for demonstration purposes.

    Tip

    If you use a DNS Made Easy add-on, contact Cloudways support to add the CNAME records.

    First, copy the CNAME Record (Name/Host and Hostname).

    Classic Interface

    New Interface

  10. Next, visit your DNS registrar and add the CNAME record.

    Important

    Before adding the CNAME record, remove any existing CNAME and A records for your domain pointing to any server IP address to avoid conflicts.

    Type: CNAME

    Name/Host: @ (as shown on the Cloudways Platform)

    If your domain registrar does not accept @ as name/host, use the root domain or leave it blank. In the case of the subdomain, specify that subdomain as name/host.

    Hostname/Value/Target: secure.cloudways.cloud (as shown on the Cloudways Platform)

    TTL: Automatic/Default or select of your choice

    After configuring CNAME records for your root domain, we recommend pointing the www version of your website to Cloudflare Enterprise Network. To do so, simply add or edit a CNAME record for your www domain pointing to your root domain.

    Type: CNAME

    Name/Host: www

    Hostname/Value/Target: secure.cloudways.cloud

    TTL: Automatic/Default or select of your choice

    Once you have added the DNS records, it may take up to 24 hours for your DNS changes to propagate and be effective. Therefore, Cloudways will periodically check to verify if the required DNS records are added or not for Cloudflare integration.

  11. Switch back to the Cloudways Platform and click Done; you will notice the current status as 'Domain not live', which means Cloudways is still verifying the DNS records.

    The time required to complete Cloudflare integration is dependent on the DNS propagation. We will notify you via email once the Cloudflare integration is successful, and the status will also change to 'Active'. If the status doesn't change after receiving the email, you can click the ⟳ Refresh button.

    Classic Interface

    New Interface

  12. Once Cloudflare is integrated with your domain, the status will change to 'Active'. Next, visit How to Manage Cloudflare to learn more about adding additional domains to it and viewing the statistics and performance of your application.

    Classic Interface

    New Interface

How to Manage Cloudflare Enterprise Add-on

Cloudflare Enterprise dashboard on the Cloudways Platform features many helpful options to manage the Cloudflare Enterprise add-on.

1. Add Additional Domains

You can also add additional domains associated with the same application to protect them with the Cloudflare Enterprise add-on.

For instance, if you have added example.com previously but you also have additional domains associated with the same application, such as example2.com or mydomain.com, you can add them here.

  1. Under the Domains tab, click Add Domains.

    Classic Interface

    New Interface

  2. Enter your domain name. Cloudflare Enterprise supports root domains and subdomains. You can enter a root domain (example.com) or a subdomain (support.example.com).

    Entering the root domain automatically covers the www domain, and it will be protected by Cloudflare Enterprise.

  3. Next, click Enable.

    Classic Interface

    New Interface

The further process is precisely the same as integrating the first domain. Navigate to How to Integrate Cloudflare Enterprise Add-on for step-by-step instructions.

2. Transfer Domains

You can transfer the Cloudflare subscription of a domain to another application hosted on the same or a different server within your Cloudways account. The traffic will be routed instantly to the selected application once the subscription is transferred.

Important

Please note that if your destination application does not have a Cloudflare integration, all the settings of source applications will be copied. If your destination application has at least one Cloudflare integration with the same domain, then the source settings will not be copied on that particular application having same domain.

  1. Under the Domains tab, navigate to your desired domain. Click ⋮ Menu and select Transfer.

    Classic Interface

    New Interface

  2. Choose your destination application.

  3. Finally, click Transfer.

    Classic Interface

    New Interface

3. Delete Domains

You can delete the Cloudflare subscription of your domain if you no longer require the Cloudflare Enterprise add-on. However, deleting a domain from here only cancels the Cloudflare Enterprise subscription for that particular domain.

Important

  • Deleting a domain means that the traffic for that domain will not be served using Cloudflare; therefore, you need to update your DNS records and point them to your Cloudways server IP address.

  • If you cancel your Cloudflare subscription on one domain and resubscribe it using the same domain, it will be counted as a separate subscription.

  1. Under the Domains tab, navigate to your desired domain. Click ⋮ Menu and select Delete.

    Classic Interface

    New Interface

  2. Next, click Delete.

    Classic Interface

    New Interface

4. Bandwidth Consumption

You can view and monitor the bandwidth consumed in the current month by your applications.

  1. To view the bandwidth consumption of each application. Head over to the Domains tab and view the bandwidth consumption of each application.

    Classic Interface

    New Interface

  2. To view the collective bandwidth usage by all applications, visit the Overview tab and check the Bandwidth section.

    Classic Interface

    New Interface

5. Features & Settings

In this section, we will discuss controlling the Cloudflare Enterprise features so you can fully utilize the Cloudflare potential according to your needs. Here's a list of features available to use:

  1. Early Hints: Boost page loading speed by automatically caching "preload" and "preconnect" link headers, sending them as "Early hints" to the browser.


  2. Image Optimization: Benefit from Cloudflare Polish, which optimizes image size through lossless or lossy compression to accelerate image downloads. Users can choose from the following options:

    • Lossless: Reduce file size for GIF, PNG, and JPEG images by removing non-essential data like headers and metadata, maintaining visual quality.

    • Lossy: Enable JPEG image compression in addition to the lossless mode, allowing for some reduction in visual quality.

    • Off: Disable image optimization entirely.


  3. Mobile Optimization: Leverage Cloudflare's Mirage, which automatically optimizes image loading for mobile devices by using virtualized and lazy-loaded images. This feature detects the visitor's browser type and optimizes performance accordingly, greatly improving image loading on mobile connections.


  4. Minification: Optimize your website's performance by enabling minification. This feature automatically removes unnecessary characters, such as "whitespace," from HTML, JavaScript, and CSS files. It can reduce file sizes by up to 20% without affecting functionality.


  5. ScrapeShield: Safeguard your website against email address harvesting by bots and spammers with ScrapeShield. It automatically displays blurred email addresses on your website, ensuring protection without any visible changes for human visitors.


  6. Caching: Toggle caching for static content, including images, HTML, and JavaScript, at Cloudflare's edge servers. You can disable caching from here. In that case, Cloudflare will continue proxying traffic to your server, but all the content requests will be served by your server, which can produce a significant load on your webserver and negatively impact your application's performance.


  7. Edge Page Caching: Enable Edge Page Caching to cache dynamic content and serve your entire website from Cloudflare's edge network. This optimization technique significantly reduces the time to first byte (TTFB) and ensures fast and consistent website performance. Note that enabling Edge Page Caching will automatically disable Varnish Page Caching to prevent conflicts.


    Note: This is only available for WordPress and WooCommerce applications and customers using the Cloudways New Interface.

  8. Under Attack Mode: Activate Cloudflare's Under Attack Mode as a last resort when your site is under a Layer 7 DDoS attack. This feature provides extra security measures by making your website accessible only to validated users while blocking suspicious traffic. Verified bots like GoogleBot and Bingbot will still be able to crawl your site unaffected.

    New Interface

6. Cache And Purge Configurations

Edge Page Caching Rules

Cloudflare Edge Page Caching follows the same Varnish rules for WordPress. Here is a list of all the essential configurations, cookies, and URLs excluded by default for WordPress.

Important

Edge Page Caching is only available for WordPress and WooCommerce applications and is available only on Cloudways New Interface.

Item Name

Description

POST

All POST requests are excluded.

HTTP Authorization

All password-protected websites are excluded.

WordPress Pages

All of the following WordPress pages are excluded.

  • /wp-login.php

  • /wp-admin

  • /wp-json

  • /wp-cron

  • /membership-account

  • /membership-checkout

  • /wp-comments-post.php

  • /?preview=true

  • /xmlrpc.php

WooCommerce Pages

All of the following WooCommerce specific pages are excluded.

  • /cart

  • /my-account

  • /checkout

  • /wc-api

  • /addons

  • /?add-to-cart=

  • /add-to-cart

  • /logout

  • /lost-password

  • /administrator

  • /?wc-ajax=get_refreshed_fragments

Cookies

All of the following cookies are excluded.

  • wordpress_logged_in

  • resetpass

  • wp-postpass

  • wordpress_

  • comment_

  • woocommerce_cart

  • woocommerce_session

  • wp_woocommerce_session

How to Configure Smart Cache Purge

Smart Cache Purge will be automatically setup on new subscriptions (launched on/after June 8th, 2023).

If you have an application(s) launched before June 8th, 2023, you will need to follow the same process by going to the Overview tab and click Configure.

Important

Edge Page Caching is only available for WordPress and WooCommerce applications and is available only on Cloudways New Interface.

New Interface

In case, you want to set up Smart Cache purge again, go to the Overview tab and click Re-Configure.

How to Purge Cache?

You can purge Cloudflare cache on-demand instead of waiting for CDN's predetermined cache expiry time.

Purging cache helps remove existing cached content of your website from Cloudflare CDN and cache the latest version of your website so that updated content can be served to the visitors. Please note that purging the cache may slow down your website temporarily until the cache is recreated.

If you have recently updated your website, purging the cache would be helpful as it prevents the older version of your website assets from being delivered to visitors.

Classic Interface

New Interface

How to Exclude URLs from Cloudflare?

You can specify URLs of pages or posts in the Breeze plugin to exclude them from Cloudflare and Varnish cache. Excluding a URL automatically adds a "no-cache" control header to avoid caching that particular page or post.

How to Bypass Cloudflare for Troubleshooting

If you want to bypass Cloudflare for troubleshooting purposes, you can simply update your host entries in the host file. This method is a recommended method for troubleshooting.

Alternatively, you can temporarily update your existing A records to point to your Cloudways server instead of Cloudflare. In the case of the CNAME record, please remove the CNAME record pointing to Cloudflare and add A records temporarily pointing to your Cloudways server.

That's it! We hope this article was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.

FAQs

General

What is Cloudflare?

Cloudflare is a popular cloud-based service that delivers services like Content Delivery Network (CDN), DNS, SSL, website protection, page caching, and acceleration. Learn more about Cloudflare.

How does Cloudflare work?

Cloudflare sits between your website visitors and the server, acting as a proxy. As a result, your website visitors don't communicate with the server anymore; instead, it communicates with the Cloudflare network.

As a result, Cloudflare reduces the number of requests to your server while allowing many visitors to access your website. At the same time, all the data passing through the Cloudflare servers is monitored to proactively block malicious traffic, filter out bad actors (like bots), and keep your website safe from any potential attacks. Learn more about how Cloudflare works.

What does Cloudflare Enterprise add-on offer?

By integrating the Cloudflare Enterprise add-on with your application, you access 200+ unique locations for the Global Content Delivery Network (CDN), an intelligent website firewall, and many performances and security features. Whether you are a small, medium, or large-sized business, the Enterprise plan is the right choice. Learn more about all the features of the Cloudflare Enterprise add-on.

How much does Cloudflare Enterprise add-on cost?

The Cloudflare Enterprise add-on pricing structure is straightforward. Each Cloudflare subscription is attached to a unique domain and offers volume discounts for professionals and agencies. Therefore, the more domains you have under the Cloudflare subscription, the cheaper it gets. Visit the pricing page to get more information.

Can I reactivate the same domain after cancelling the subscription?

If you cancel your Cloudflare subscription on one domain and resubscribe it using the same domain, it will be counted as a separate subscription.

I already have the free Cloudflare CDN. So why should I opt for Cloudflare Enterprise?

The free version of Cloudflare CDN is also good but offers limited features; therefore, if you have a mission-critical website where website performance, security, and availability are top priorities, the Cloudflare Enterprise add-on is the right choice.

Enterprise CDN caches your content as close as possible to your visitors, optimizes it on the fly, and serves it on a priority basis over all other Cloudflare traffic. The Enterprise plan also offers security features that the free version does not, such as Web Application Firewall (WAF) advanced rules that block hackers and mitigate attacks before you even notice. Additionally, it offers priority DDoS protection, PCI DSS compliance, and much more. Learn more about all the features of the Cloudflare Enterprise add-on.

I have a small website, so should I use the Cloudflare Enterprise add-on?

The Cloudflare Enterprise add-on is for websites of all sizes. Cloudflare Enterprise caches your website content to accelerate your website performance, positively impacting your website's SEO. It also optimizes images, compresses files, and improves image performance for users on a mobile connection.

Cloudflare also offers excellent security with an intelligent firewall that updates itself to deal with the latest threats and includes rulesets specifically for WordPress and Magento. DDoS attacks are mitigated within 3 seconds, so your website will always be available. Learn more about how Cloudflare works and the features of the Cloudflare Enterprise add-on.

Will Cloudways have access to my personal Cloudflare account?

No, Cloudways will not have access to your personal Cloudflare account.

I don't see the Cloudflare Enterprise option for my application. What should I do?

If the Cloudflare section is not available for applications, it could be because:

Will Cloudflare affect my site's SEO?

Cloudflare will positively impact your website's SEO as Cloudflare's firewall and DDoS protection will secure it. Without a firewall and DDoS protection in place, an attack on your site can lead to your server being inaccessible to search engine crawlers. With Cloudflare's DDoS protection, attacks on your site will be stopped before they cause any issues for search engine crawlers.

Does the add-on support Automatic Platform Optimization (APO)?

APO is a Cloudflare product for WordPress websites to achieve Full Page Caching over Cloudflare's Global Content Delivery Network (CDN) to serve static HTML pages to users. We are not currently offering Full Page Caching with our integration, but it will be launched soon.

Which static files are cached by Cloudflare?

Cloudflare only caches based on the file extension and not by MIME type. The Cloudflare CDN does not cache HTML by default. The following content is cached by default. Additionally, Cloudflare caches a website's robots.txt.

7z

dmg

jpeg

png

webm

avi

ejs

js

ppt

webp

avif

eot

mid

pptx

woff

apk

eps

midi

ps

woff2

bin

exe

mkv

rar

xls

bmp

flac

mp3

svg

xlsx

bz2

gif

mp4

svgz

zip

class

gz

ogg

swf

zst

css

ico

otf

tar

csv

iso

pdf

tif

doc

jar

pict

tiff

docx

jpg

pls

ttf

Can I change firewall/Page rules settings?

Since it's a fully managed firewall, you will not be able to see or customize any firewall settings or page rules. Instead, the Cloudflare Enterprise will automatically take care of the security and speed of your site.

How to exclude custom cookies for Edge Page Caching?

Unfortunately, this feature is currently unavailable. However, this will be released in the next iteration.

Why is Cloudflare not allowing me to log in to the admin dashboard?

Cloudflare Enterprise may block you from accessing the website admin dashboard in case you have a custom admin dashboard URL. In this case, you must revert to the default admin dashboard URL. For WordPress, it should be domain.com/wp-admin and for Magento, it should be domain.com/admin.

Is Cloudflare Enterprise Integration Using Cloudflare's WAF?

Yes, it does. The Cloudflare Enterprise is powered by three WAF Managed Rulesets that are pre-configured to provide immediate protection against:

  • Zero-day vulnerabilities

  • Top-10 attack techniques

  • Use of stolen/exposed credentials

  • Extraction of sensitive data

Compatability-related

Can I integrate the Cloudflare Enterprise add-on if I don't have a Cloudflare account?

Cloudflare Enterprise add-on does not require you to create a Cloudflare account. Instead, you can start today by integrating Cloudflare Enterprise with your application.

I already have a Cloudflare plan (free or paid); how can I integrate the Cloudflare Enterprise add-on?

The Cloudflare Enterprise add-on is separate from your personal Cloudflare account; you can continue using your personal Cloudflare plan or integrate the Cloudflare Enterprise add-on by Cloudways.

I am already using CloudwaysCDN (Stackpath). What should I do?

CloudwaysCDN is deprecated as of March 22nd, 2022, because a new and better-performing alternate is available called Cloudflare Enterprise. As a result, new CloudwaysCDN subscriptions will no longer be available and supported. However, existing subscriptions will continue to work for the time being. The end-of-life for CloudwaysCDN is expected to fall towards the end of Q2 2022.

You can switch to the Cloudflare Enterprise add-on today to avoid any disruption. First of all, remove the CloudwaysCDN subscription and integrate the Cloudflare Enterprise add-on.

Can I use a different CDN other than Cloudflare Enterprise?

Cloudways gives you complete freedom to choose your CDN provider, requiring manual work. Cloudflare Enterprise is an optional add-on that you can activate from the Cloudways Platform whenever you are ready with a few clicks.

Can I use my custom SSL Certificate with Cloudflare?

Unfortunately, we don't support custom SSL certificates currently with Cloudflare.

Are my plugins compatible with Cloudflare?

WordPress plugins compatible with Cloudways' existing cache configuration will remain compatible with the Cloudflare Enterprise.

Once Cloudflare is activated, do you need to disable Bot Protection by Cloudways (MalCare Security) plugin?

There is no need to disable Bot Protection or any other security plugins on your site. There should be no issues with those plugins after integrating Cloudflare.

Can I still manage my DNS records with my current DNS provider?

Yes, you can. Enabling Cloudflare doesn't require changing your nameservers; therefore, you can still manage your DNS records at your current DNS provider.

Once Cloudflare is activated, do I need to disable the cache plugin like Breeze/WP-Rocket?

No, you don't need to disable any cache plugins. However, please note that the Content Delivery Network (CDN) cache functionality is limited to static content. In contrast, Breeze is a page cache plugin that helps with dynamic page caching.

Can I use any other cache plugin other than Breeze for Smart Cache Purge?

While you can utilize other cache plugins, such as WP Rocket or FlyingPress, it's necessary to have Breeze installed and activated for Smart Cache Purge. To avoid conflicts with your current cache plugin, ensure that all cache and optimization settings are disabled.

The Smart Cache Purge Configure option in the Cloudways Platform automatically installs the Breeze plugins (if not already installed) and disables all configurations to prevent conflicts with your existing cache plugin.

Can I use Ezoic CDN along with Cloudflare?

No, you can not use Ezoic CDN with Cloudflare as it offers its CDN; thus, it is not recommended to reintegrate Ezoic CDN on top of Cloudflare CDN.

Integration-related

Do I need to remove the existing A Records pointed to my Cloudways server while pointing the domain using CNAME or A records?

To avoid conflicts, you must remove any existing A and CNAME records for your domain pointing to your Cloudways server IP address.

Should I add both A records or one while pointing the domain to Cloudflare Enterprise Network, as the CNAME record is not supported by my DNS provider?

You can use any one A record while integrating it. However, we highly recommend adding both A records to ensure you can fully utilise the Cloudflare load network balancing setup.

Do I need to do anything extra if I use WordPress multisite application?

If you use the WordPress Multisite application, you don't require any additional steps to integrate the Cloudflare Enterprise add-on.


WordPress hosting by Cloudways allows you to use Cloudflare for a secure and fast experience.

Did this answer your question?