Cloudflare is an excellent tool for speeding up your WordPress site – or any other web application for that matter. Often though, developers forget to optimise Cloudflare for the sections of their sites that shouldn’t be cached.
In this article, we’ll enrich you with the essential knowledge to tackle this issue in WordPress; failure to do so can result in certain parts of your WordPress admin area becoming dysfunctional or behaving unexpected, especially if you start adding plugins with various functionalities.
Optimising Cloudflare
So, what needs to be done?
The good news is that any Cloudflare account – free or paid – can perform the necessary setup to prevent the aforementioned issue. The solution involves creating a page rule for the WordPress admin area, which increases security and disables the relevant parts of Cloudflare’s caching features.
1. Navigate through the Cloudflare dashboard
Select your domain > Go to Rules > Go to Page Rules > Click Create Page Rule
2. Configure the page rule
The applicable URL for the page rule will depend on your domain and where you installed WordPress. Essentially, we need to target the path for the WordPress admin area.
URL: www.example.com/wp-admin*
Then configure the following settings.
Security Level: High
Cache Level: Bypass
Disable Apps: Apps are disabled
Disable Performance: Performance is disabled
Click + Add a Setting for each rule listed above.
3. Deploy the page rule
When you’re done configuring the page rule, you’re ready to deploy it to Cloudflare’s network. In order to do so, click Save and Deploy Page Rule to finalise the setup. That’s it!
You’ve now successfully restored full functionality to the WordPress admin area while still caching the frontend and keeping your site secure. You can always edit the page rule, or tune it to your liking depending on your needs.
Summary
Now you know how to deploy page rules with Cloudflare specifically for WordPress. The use cases are plenty though, and you should explore how else Cloudflare’s page rules can help you optimise and secure your web applications.
Thank you for reading, and happy tuning.