How to Set Up Magento Cloudflare CDN in Easy Steps

How to Set Up Magento Cloudflare CDN in Easy Steps

Magento Cloudflare is a robust Content Delivery Network (CDN) designed to enhance the performance and security of a Magento 2 store. Cloudflare boosts website performance by caching and distributing content globally, resulting in faster page load times and improved availability. This tutorial will cover setting up and configuring Cloudflare for your Magento 2 store.

Key Takeaways

  • Understanding the integral role of Magento Cloudflare CDN in augmenting a store's performance.

  • Recognizing the significant contribution of Cloudflare in enhancing website load times and availability.

  • Learning comprehensive steps to set up and configure Cloudflare for Magento 2.

  • Gaining insights into the global distribution potential of Cloudflare for content caching.

  • Appreciating the dual advantage of Cloudflare in boosting performance and ensuring security for Magento 2 stores.

Why To Use Cloudflare for Magento 2

A large Magento store can be a resource-intensive platform.Cloudflare offers an ideal solution to optimize Magento 2 store performance, increase sales conversions, and improve customer experience. Here are the top reasons why you should use Cloudflare for your Magento 2 store:

  • Global Content Delivery Network (CDN): Cloudflare has a vast network of servers worldwide, allowing your content to be distributed globally with low latency and high availability. This reduces page load times for visitors, especially those in different regions from your origin server.

  • Improved Performance: Cloudflare enhances speed performance by caching static content like images and videos. It automatically minimizes HTML, JavaScript, and CSS, reducing the size of the source code and optimizing browser cache for faster content loading.

  • Enhanced Security: Cloudflare provides various security features to safeguard websites, including DDoS protection, SSL/TLS encryption, and malware removal. Its web application firewall (WAF) feature effectively blocks numerous attacks like bad traffic, injection attempts, brute force attacks, and checkout fraud bots.

  • DNS Load Balancing: Cloudflare offers a DNS service that helps distribute traffic across servers and data centers, ensuring efficient load balancing for your Magento site. Additionally, Cloudflare utilizes advanced technology to prevent DNS Spoofing and Man-in-the-middle attacks, providing enhanced security for your website.

Prerequisites for Setting Magento 2 Cloudflare

To configure Cloudflare for Magento 2, there are a few initial steps you must undertake:

  • Create a Cloudflare account.

  • Authorize the domain you want to associate with Cloudflare.

  • Ensure that you have set up your Magento store properly.

To use Cloudflare, it is necessary to have ownership of a domain. If you don't already own a domain and intend to use Cloudflare for your authoritative DNS, I strongly suggest acquiring your domain name through Domain Register.

Alternatively, you can simplify the setup process by opting for Cloudflare Registrar, which automatically utilizes Cloudflare for authoritative DNS.

Checklist for Preparing Magento 2 Store for Cloudflare Integration

4 Steps to Set Cloudflare CDN in Magento 2

1. Sign up for a Cloudflare account and link your domain name to it.

To get started with Cloudflare, visit their website. Click the "Sign Up" button to create your Cloudflare account.

To create an account, simply input your email and password in the designated fields. Afterward, click on the "Create Account" button.

Cloudflare Account Creation Interface for Magento Users

Once you have successfully created your CloudFlare CDN account, simply enter your domain name in the designated field on the website and click the "Add site" button.

Adding a Domain to Cloudflare for Magento Store Enhancement

To get started with the configuration process, follow Cloudflare's instructions.

2. Set your domain nameservers to Cloudflare

To switch your DNS to Cloudflare, go to the domain management page and update the nameservers. In this case, set the DNS to:

  • kiki.ns.cloudflare

  • oswald.ns.cloudflare

3. Configure CloudFlare to server

To access the CDN tab in CloudFlare, navigate to the CloudFlare dashboard and locate the CDN section. You must fill in the necessary DNS records to point to the server's IP address. Please note:

  • Before configuring the CDN, enable Cloudflare by clicking on the yellow cloud icon.

  • Enabling the CDN will result in a change of IP address. If your server has SSL enabled, you won't be able to use Cloudflare's CDN, and your website may display an error notification.

To address this issue, one option is to utilize Cloudflare's SSL under the Crypto tab.

Configuration Settings in Cloudflare for Magento 2 Server

4. Install the Cloudflare module for Magento 2

  • To enable Cloudflare functionality on your website, you should purchase the Cloudflare module from Marketplace. Once purchased, you can proceed to set up the module using Composer.

  • The module on the Marketplace can be found at cloudflare/cloudflare-magento.

  • Now, you need to access the SSH and root folder of Magento 2.

  • Use this command: composer require cloudflare/cloudflare-magento:1.1.3

  • Once Cloudflare has been set up successfully, access the Admin panel.

Magento 2 Admin Panel Displaying Cloudflare Module Installation Steps

To access Cloudflare, log in to the Module's Config and click on the View button to obtain the API Key.

Accessing Cloudflare Settings After Module Installation


1. What is the role of the Cloudflare SSL in maintaining Magento stores?

The Cloudflare SSL is essential in securing information transfer between users' browsers and the sites. It provides a secure HTTPS way for data transmission, protecting sensitive customer data and increasing user trust. It's particularly beneficial for WordPress and Magento stores handling customer information and payment transactions, contributing to PCI compliance.

2. How can integrating Cloudflare provide value to my business?

Cloudflare offers comprehensive internet services that enhance your website's performance and security. It optimizes web traffic through its global cloud network, reducing latency and improving site load times. Cloudflare also provides DDoS protection, SSL, and edge security, crucial for businesses handling sensitive customer data. Moreover, it includes features like Brotli compression for further optimization and specific applications for platforms like WordPress, Wix, and Magento.

3. Issues with the Cloudflare plugin on my WordPress site, where can I seek help?

Cloudflare has an extensive knowledge base and documentation on its website that guides users through various settings and configurations. You can also check the FAQ sections for common issues or consult the Cloudflare community forums. For specific plugin bugs or issues, you can use the GitHub page for the Cloudflare plugin to report the problem and seek solutions.

4. What are Cloudflare page rules, and how can they benefit my website's traffic?

Cloudflare page rules allow you to control how Cloudflare works per-URL basis, providing detailed and flexible control over how your web resources function. You can use page rules to improve performance, enhance security, minimize bandwidth, and manage redirections. These rules can help optimize your site's web traffic and user experience.

5. Can I use Cloudflare with my Magento extension, and what are the steps for setup?

Yes, you can use Cloudflare with your Magento extension. First, install the Cloudflare module for Magento. Access Magento's SSH and root folder, and use the composer command to require the Cloudflare module. Once Cloudflare is set up, you can configure your settings from the Admin panel. Remember to have your API Key ready for integration. Detailed guides can be found in Cloudflare's documentation.

6. How can I ensure the status of my Magento hosting plan is optimal using Cloudflare's proxy files?

To ensure the optimal status of your Magento hosting plan using Cloudflare's proxy files, you need to configure Cloudflare to serve your content. In your Cloudflare dashboard, navigate to the Caching tab and ensure that the 'Standard' caching level is selected.

This will allow Cloudflare to serve static files (like CSS, JS, and images) from its cache, improving load times. If you encounter any issues, check the proxy status in the DNS settings. Also, regular maintenance of your Magento site, like updating to the latest versions, helps maintain optimal performance.

7. How does Cloudflare help maintain different versions of Magento websites?

Cloudflare supports all versions of Magento and provides a useful feature known as 'Under Attack Mode' that can be beneficial during website maintenance. If you're updating your Magento version and your site is in maintenance mode, you can enable 'Under Attack Mode' in the Cloudflare dashboard to serve a Cloudflare landing page to your visitors.

This ensures users have a good experience while you're performing updates in the background. Remember to disable this mode once your maintenance is complete.


Enhance the performance of your website by implementing Magento CloudFlare CDN. This will help your website load faster, reducing the bounce rate and increasing customer satisfaction. With the right Magento-managed hosting, you can optimize your website's performance and ensure smooth operation.

Shivendra Tiwari
Shivendra Tiwari
Technical Writer

Shivendra has over ten years of experience creating compelling content on Magento-related topics. With a focus on the Magento community, he shares valuable tips and up-to-date trends that provide actionable insights.

Get the fastest Magento Hosting! Get Started