Totally Clear Cloudflare Cache at Intervals - Forms Not Working

Hey, so what is happening is something is getting caught in my Clouflare cache that is preventing using the contact forms on my website. After I clear the CF cache, the forms will work fine for a few hours and then they stop working again. Can I add a cron job to clear the cache at regular intervals? If coding is needed can you show me an example of what it would look like?

Any assistance is greatly appreciated.

You can make a bash script or something and schedule it via cron. You can use the Cloudflare API to purge all files or purge files by URL. I suppose, your other option, may be to bypass whatever is causing problems when it’s cached from being cached to begin with.

Hey there!
I am not sure if this is the best way to solve your issue, but lacking any better solution, i have done this once before.
You’ll need to setup an API key, ideally with only the privilege to access the single zone and permission you require.
Then you can setup a cron job with a curl command:

curl -X POST \
     -H "X-Auth-Email: $CF_EMAIL" \ 
     -H "X-Auth-Key: $CF_KEY" \ 
     -H "Content-Type: application/json" \ 
     -d '{"purge_everything": true}' \

Something along the lines of this should do the trick, please excuse if escaping of characters is not 100% but I did it using Postman and automated it with Newman.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.