What is proxy caching

Speed is important. Even if you have optimized your site already, the load times can vary based on the physical location. You may also have a good server, but you can still improve TTFB and page load time with proxy caching.

Many sites are using Cloudflare as a CDN, however you can also use it to cache your pages, and let Cloudflare serve them to your visitors. It means, that on the first visit Cloudflare will cache the page content as well, so following requests won’t even hit your server. Of course if you are using Cloudflare for page caching you will need to enable Auto Purge for Cloudflare.

NOTE: only Cloudflare Business and Enterprise packages let you to bypass the cache based on cookies, however in most cases you can also use this feature with their free plan, but your logged in users will get the same cached pages. Of course My Account, Cart, Checkout (and any excluded) pages won’t be cached.

Here you can find a detailed example using Proxy caching with Cloudflare


You should take care to clear proxy cache when it is necessary. If you are using Cloudflare, which is the most common case, you can simply enable Autopurge and configure Cloudflare in Swift Performance Settings.

You can enable Proxy Caching in Caching » Tweaks and configure Proxy Cache Timeout as well. You can set timeout to 30879000 (1 years in seconds), because if Cloudflare Autopurge has been enabled in Swift Performance settings, then Swift Performance will be able to clear Cloudflare cache when it is necessary.

If you are using a custom proxy caching you can use clear cache action hooks to clear proxy cache when it is necessary.


add_action('swift_performance_after_clear_permalink_cache', function($url){
	// clear proxy cache code here

How to use Proxy Caching with Cloudflare