Bobcares

Steps to Set Cloudflare CDN in Magento 2

Here are the steps to set Cloudflare CDN in Magento 2. Our CloudFlare Support team is here to answer queries and concerns.

Steps to Set Cloudflare CDN in Magento 2

Magento 2 is a resource-intensive eCommerce platform. This is why integrating it with a Content Delivery Network (CDN) like Cloudflare is a smart move.

Steps to Set Cloudflare CDN in Magento 2

This helps deliver an exceptional customer experience and maintain high performance under heavy traffic.

Cloudflare optimizes our Magento 2 store by reducing latency, boosting load speed, and enhancing security.

Today, we will examine Cloudflare for our Magento 2 setup, along with step-by-step guidance to get started.

Benefits of Using Cloudflare for Magento 2

  • Cloudflare allows our website content, images, videos, scripts, and more to be delivered from the server closest to the customer’s location. This results in significantly faster page load times, particularly for international visitors.
  • Cloudflare caches static content and automatically minifies HTML, CSS, and JavaScript files. This reduces file sizes and ensures faster loading speeds. Additionally, Cloudflare leverages intelligent browser caching and HTTP/2 to enhance responsiveness and reduce bandwidth usage.
  • Furthermore, Cloudflare also offers built-in protection against threats like DDoS attacks, SQL injection, and spam bots. This keeps our Magento store secure while ensuring high availability for legitimate users.

If you plan to use Wildcard SSL with your store, ensure that you configure it properly to avoid compatibility issues. Here’s a complete guide on setting up Cloudflare Wildcard SSL.

How to Integrate Cloudflare with Magento 2: Step-by-Step Guide

Step 1. Create a Cloudflare Account and Add Your Domain

  1. Head to Cloudflare.com and click on the Sign Up button.
  2. Then, enter the email and password, and click Create Account.
  3. After signing up, enter the Magento domain name and click Add Site.
  4. Follow the on-screen instructions to begin the configuration process.

Occasionally, users may encounter zone-related issues during setup. If you receive an error like “Cloudflare failed to find zone”, refer to this troubleshooting guide for a quick fix.

Step 2. Update Your Domain’s Nameservers

  1. Log in to the domain registrar’s control panel.
  2. Then, update the nameservers to point to Cloudflare.
  3. Save the changes. DNS propagation may take a few hours to complete.

Step 3. Configure DNS and SSL in Cloudflare

  1. In the Cloudflare dashboard, go to the DNS tab and add DNS records pointing to the server’s IP.
  2. Then, enable Cloudflare (yellow cloud icon) to activate CDN.
  3. If the server uses SSL, ensure compatibility by going to the SSL/TLS tab in Cloudflare and selecting Flexible or Full SSL based on the server configuration.

Our experts would like to point out that when Cloudflare is active, it masks our original server IP.

One common issue Magento users run into is Cloudflare Error 1003, especially when working with DNS records. Here’s how to resolve it.

Step 4. Install the Cloudflare Module for Magento 2

  1. Purchase the official Cloudflare module from the Magento Marketplace.
  2. Then, install the module using Composer:
    composer require cloudflare/cloudflare-magento:1.1.3

    We can replace `1.1.3` with the appropriate version for our Magento instance.

  3. After installation, access the Magento Admin Panel and go to the module’s configuration section.
  4. Then, log in to the Cloudflare account and click View API Key.
  5. Enter the key in the module settings to complete integration.

CNAME issues, such as Error 1014 (CNAME Cross-User Banned), can sometimes appear during setup, especially in shared hosting environments. Learn how to resolve Cloudflare Error 1014 here.

How to Verify Cloudflare Integration with Magento 2

After setup, follow these steps to ensure that Cloudflare CDN is working correctly:

  1. Open the Magento 2 store in a browser.
  2. Then, right-click on the page and select Inspect.
  3. Now, go to the Network tab and click on a JavaScript or CSS file.
  4. Now, look for the `cf-cache-status` header. If it shows `HIT`, Cloudflare caching is active and functioning correctly.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

Integrating Cloudflare with your Magento 2 store is an effective way to enhance performance, reduce server load, and improve security.

In brief, our Support Experts took us through the steps to set Cloudflare CDN in Magento 2.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF