Cloudflare improves your website performance quite significantly. You’ll be able to deliver your content to worldwide users more quickly, reliably and securely at a reasonable cost.
Having said that, server caching could cause some side effects on your protected files and content. For example, file attachments protected by Prevent Direct Access Gold will be cached by Cloudflare, and so, accessible to anyone including those without permission. Server caching stops our file protection from working properly.
In this article, we will show you how to create a new Page Rules to exclude your protected files from Cloudflare’s caching in just 2 steps.
Step 1: Login to the Cloudflare dashboard. Select the domain that you want to disable caching for your protected files.
Step 2: Click on Page Rules tab and then Create Page Rule as follows:
- Pattern: https://yourwebsite.com/wp-content/uploads/_pda/*
This pattern excludes Prevent Direct Access Gold protected folder (_pda) and files from Cloudflare caching
- Settings: select Cache Level and Bypass
Step 3: Finally, click Save and Deploy. Our file protection and permission should be working correctly now on your website.
References: How do I exclude a specific URL from Cloudflare’s caching?