All Collections
​​Configuring Cloudflare to Work With NitroPack
​​Configuring Cloudflare to Work With NitroPack
Updated over a week ago

If you use Cloudflare, you must configure API access, so NitroPack can sync both caches and ensure the best possible performance.

You can do it via:

  1. API Token

  2. Global API Key

Important: While both NitroPack and Cloudflare support Global API Key, we strongly recommend using the API Token. Global API Key has multiple limitations related to resource access, shared permissions, and lack of advanced usage limits. You can read more here.

Connecting Cloudflare to NitroPack via API Token

1. Log into your Cloudflare account.

2. Select the domain associated with your NitroPack account:

3. On the next screen, scroll down to the bottom of the page and click “Get your API token” from the right sidebar menu:

4. Then, click “Create Token”:

5. Scroll down to the last section, “Custom token,” and click “Get Started”:

6. After you give your API token a descriptive name, go to “Permissions” and add the following three rules:

  • Zone >> Zone Settings >> Edit

  • Zone >> Cache Purge >> Purge

  • Zone >> Page Rules >> Edit

7. Next, scroll down to “Zone Resources,” ensure to select the domain associated with your NitroPack account:

Important: For the token to work properly, do not assign Start and End date in the “TTL” section.

8. Finally, click “Continue to summary”, then “Create token”. From the “User API Tokens” page, copy your token:

9. To complete the configuration, go to your NitroPack app >> Integrations >> Cloudflare, and paste your token:

Save your settings.

If you did everything correctly, a success message will appear.

Connecting Cloudflare to NitroPack via Global API Key

Step 1 - Linking NitroPack with Cloudflare

1. Log into NitroPack’s app and go to “Integrations”.


2. On the next screen, select "View Settings" in the Cloudflare widget.


3. Insert your Cloudflare account e-mail address and Cloudflare Global API Key.

To find your correct API key, follow the instructions here:

You can also find the API keys in your Cloudflare dashboard:

4. After filling in your Cloudflare credentials, the "Save" button will become active, allowing you to save your settings and complete the process.


Step 2: Disable Mirage & Rocket Loader™

Once you connect NitroPack to Cloudflare, NitroPack will automatically disable the features Mirage and Rocket Loader™ to ensure everything is working smoothly. Mirage and Rocket Loader™ must remain disabled, as these are features that clash with NitroPack.

To disable them manually:

1. Go to your Cloudflare dashboard:

2. Select your website, and go to Speed > Optimization Disable Mirage Disable Rocket Loader™

Step 3: Modify Page Rules

If you don't have any Page Rules configured in Cloudflare, skip this step.

In case you have any existing Cloudflare Page Rules, follow the instructions here to configure them.

To find the Cloudflare Page Rules:

1. Go to your Cloudflare dashboard:

2. Find Page Rules in the main menu

Ensure all your Page Rules meet the criteria below:

Edit Edge Cache TTL rules

In all Page Rules that contain Edge Cache TTL, remove Edge Cache TTL, or set Edge Cache TTL to 0.

Remove Rocket Loader™ rules

Remove all Page Rules that enable Rocket Loader™

Remove Mirage rules

Remove all Page Rules that enable Mirage

Important Note for Automatic Platform Optimization (APO) Users

NitroPack is compatible with Cloudflare's APO service. If you've gone through the steps above, NitroPack and APO should work fine automatically.

In case you wish to set up Cloudflare's APO, check out our article:

However, please note that when both services are working simultaneously, it might take longer for cache purges to produce an effect. That's why content updates may not appear instantly on your site.

For more details about the differences between NitroPack and Cloudflare's APO, please refer to this article.

📌 If you need any assistance or have questions, you can always reach out to our support team at [email protected] or via this link:

Did this answer your question?