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.php 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.php file (remember 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 );
- Set caching level to Agressive
- Activate minification
- Deactivate Rocket Loader
- Set browser cache to 1 month
This option should only be used with Cloudflare’s Flexible SSL feature!
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. (Rocket Loader is in no way related to WP Rocket.)
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.