When using Super Page Cache for Cloudflare along with WP Rocket plugin it is highly recommended that you do not use more than one page caching system on your site as that will lead to compatibility issues and problems.
Whether you have a server level page caching system or some other page caching plugin installed in yoru site, you need to ensure that all page caching mechanisms are disabled on those plugin before using the Super Page Cache for Cloudflare plugin on your website. Also, ensure that there is no server rule in your .htaccess
file or nginx.conf
file which is modifying the cache-control
header value of the page as that value needs to be managed by the Super Page Cache for Cloudflare plugin.
Here is what you should do if you are uising WP Rocket along with Super Page Cache for Cloudflare to get the best results.
First make sure that both WP Rocket and Super Page Cache for Cloudflare are disabled on your wensite and inside your wp-config.php
file there is no WP_CACHE
constant. If you see a statement like define( 'WP_CACHE', true );
or something similar inside your wp-config.php
file, please delete that line and save your wp-config.php
After this README documentation you will file another file named wp-rocket-no-cache.php
file attached to it. Make a copy of that file in your system either by downloading the file or creating a file with the same name and copy poasting the content given below.
After that open your FTP client and go to /wp-content/mu-plugins/
folder. Inside /wp-content/
if you do not see the mu-plugins
folder, just create a new folder and name it mu-plugins
. Then inside this folder put the mu-plugin code given below.
Finally, when you go inside yoru WP Admin > Plugins
section, now you should see that a new Must Use Plugin
section has been added and under which this WP Rocket - No Cache plugin is mentioned. This will ensure that you have done this step right.
Now enable the WP Rocket Plugin and make sure page caching or mobile device caching is disabled inside this plugin. After enabling WP Rocket, open the FTP cleint again and open wp-config.php
file. This time there should not be any mention of the WP_CACHE constant.
Similarly, when you would go inside the /wp-content/
folder, there should not be any advanced-cache.php
file as well.
You can use WP Rocket to optimizing your static files like CSS/JS etc. or you may use other plugins dedicated to static file optimization like Autoptimize. For image optimization, there is Cloudflare Polish (comes with Cloudflare Pro plan and above), Imagekit, Optimole, Shortpixel, EWWW Image Optimizer etc.
But this gist is for those who must need to use WP Rocket.
Now it is the time to enable the Super Page Cache for Cloudflare plugin, enter the Cloudflare API details and enable page cache. After this, everything should work fine without any major issues.
Hi @fedeandri,
First of all when using Super Page Cache for Cloudflare plugin, the usage of fallback cache is optional because when pages are cached at Cloudflare CDN level, the response will be served from the Cloudflare CDN edge nearest to you, the request won't even reach the origin server. Now in situations where the cache has expired from CDN or hasn't been cached yet, only in those cases, the requests will come to the origin server. At that point, if the fallback cache is disabled, then the PHP will be used to generate the page HTML content which will then further be cached at Cloudflare CDN. Alternatively, if the fallback cache is enabled, the system will look if the page being requested if that page is already cached in the fallback cache, if so then serve that cached HTML from the disk-level fallback cache or use PHP to generate the page content.
Now if you have enabled page caching inside WP Rocket and disabled the fallback cache in Super Page Cache for Cloudflare plugin, WP Rocket's code will overwrite the page cache and most importantly page response headers. So, Super Page Cache for Cloudflare plugin will not have any control over the page response header which will cause issues of the page being properly cached at Cloudflare level as WP Rocket will be overwriting the page response headers. So, you need to make sure that WP Rocket does not handle the page caching operation in any way, it may do static file optimization if you would like to use it, but not page caching. That should always be handled by Super Page Cache for Cloudflare only.
If you would like to have a disk-level fallback cache on your website, you can definitely use the fallback cache feature inside Super Page Cache for Cloudflare plugin, But if your site has good traffic and you think pages are staying cached for a long period of time in the CDN, you can disable that as well. It's totally up to you.