# Cloudflare

Using Cloudflare is not obligatory when launching a project on Readymage or any other hosting provider, but we strongly advise considering its inclusion due to the numerous benefits it offers. In essence, Cloudflare enhances speed, security, and protection against DDoS attacks and robots, as well as provides valuable traffic insights.

To delve further into Cloudflare's features:

* As a Content Delivery Network (CDN), all requests are routed through Cloudflare. With a vast network of servers located closer to end users, it can cache responses and deliver them faster.
* Cloudflare optimizes images by converting them into smaller, more modern formats.
* It possesses the ability to identify and block DDoS attacks.
* Cloudflare includes rate-limiting capabilities, which can be advantageous in preventing data exfiltration from APIs.
* It offers insights regarding traffic, such as the country, network provider, user agent, and other metadata. These insights aid in making informed blocking decisions and gaining a better understanding of incoming traffic.
* Cloudflare incorporates a web application firewall (WAF) that blocks malicious requests.

Follow the [appropriate instructions](https://help.readymage.com/project-development/connect-cdn-and-webp-optimization) depending on where your domain is hosted to configure Cloudflare and ReadyMage instance connection.&#x20;

Access the Cloudflare setting through the **User Portal → Project → Selected Instance → Service Management → Cloudflare**.&#x20;

<figure><img src="https://2103450200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKew-XtJKAPabdeTxXg%2Fuploads%2FcpC3mESUFqu2RweKBhOU%2Fimage.png?alt=media&#x26;token=e226b305-6a85-47cd-bde5-0a5d65f7f77b" alt=""><figcaption></figcaption></figure>

#### Cloudflare Cache Purging Functionality

**Purge Cache:**\
Purge cache is used to clear Cloudflare caches either by URLs or hostname

<figure><img src="https://2103450200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKew-XtJKAPabdeTxXg%2Fuploads%2FnUAF7wUKPcWtKUl6WhS5%2Fimage.png?alt=media&#x26;token=4449766e-271e-4565-a012-ca2ec9e92974" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The domains need to be managed by ReadyMage Cloudflare account <admin@readymage.com>, if not then the Project Owner would need to provide Cloudflare API Token and Zone ID to be able to use the functionality as discussed below
{% endhint %}

**Cloudflare Credentials:**

<figure><img src="https://2103450200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKew-XtJKAPabdeTxXg%2Fuploads%2FWTMJAnsgAvB2ErlJQUBQ%2Fimage.png?alt=media&#x26;token=102b37bf-4d4c-4199-b071-73dccde086c8" alt=""><figcaption></figcaption></figure>

In case of hosting domains which are not managed by us, the Project Owner would need to provide Cloudflare credentials as described in the below Cloudflare developer guides:

* [API Token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) - Select **Cache Purge** permission
* [Zone ID](https://developers.cloudflare.com/fundamentals/account/find-account-and-zone-ids/#copy-your-zone-id)

#### Exclude Magento admin from Cloudflare

If you are running long processes in Magento admin, it is recommended that you set up a separate domain for Magento admin and disable Cloudflare to avoid operation timeouts. Find detailed instructions [here](https://help.readymage.com/project-development/connect-cdn-and-webp-optimization#exclude-magento-admin-from-cloudflare).
