Using WP Rocket with CloudFlare
WP Rocket is totally compatible and complementary with CloudFlare.
The first step to use them together, is adding your site to your CloudFlare account. If you haven't done this yet, follow CloudFlare's tutorial: Create a Cloudflare account and add a website.
CloudFlare can perform the minification process of CSS and JS files as well as WP Rocket, but there is one extra thing that WP Rocket does, and it is called concatenation. This means that WP Rocket combines files into little groups for better compatibility and performance, and that is one useful feature that is not included in CloudFlare.
We recommend you activate minification in CloudFlare as well as WP Rocket in order to get the best results.
Note: If you use the WP Rocket CloudFlare integration, you no longer need the official CloudFlare plugin. WP Rocket provides the same function of providing originating IP addresses. As of WP Rocket 2.7, we also provide https protocol rewriting.
WP Rocket’s CloudFlare Settings
In the CDN tab in Settings → WP Rocket you will see the Show CloudFlare settings tab checkbox. Check that one and a popup will appear. Confirm, save changes, and the CloudFlare Tab will appear.
Go to it and you will see multiple options:
- Account Email – Fill in email address used for creating CloudFlare account
Global API Key – Login to your CloudFlare account and visit your Account page. You will see this:
Copy the Global API Key and paste in WP Rocket settings.As of WP Rocket 2.6.7, you can also define your API key in your wp-config file. This can be especially useful if you have several sites under the same CloudFlare account. Here is how you would add it to your wp-config file (remeber to replace the second value in the example with your own API key):
You can also hide the API Key field if you prefer to keep it secret:
define( 'WP_ROCKET_CF_API_KEY_HIDDEN', true );
The most common cause of issues when using CloudFlare is their Rocket Loader feature. If you have display or other issues when using CloudFlare, disable Rocket Loader and clear your cache to see if this fixes the problem.
CloudFlare Cache purge error: No Zone ID set in the WP Rocket settings
If you're receiving this error after configuring CloudFlare, or when purging CloudFlare cache, please try this:
- Go to WP Rocket → CloudFlare settings tab.
- Empty the domain text field and save settings.
- Then re-add your domain and save the settings again.