Cloudflare使用API清理所有缓存
使用Cloudflare提供API定时清理所有CDN缓存。
首先获取API
https://support.cloudflare.com/hc/zh-cn/articles/200167836
清理缓存方法
curl -X POST "https://api.cloudflare.com/client/v4/zones/{ZONE_ID}/purge_cache" \
-H "X-Auth-Email: {YOUR_EMAIL}" \
-H "X-Auth-Key: {YOUR_GLOBAL_API_KEY}" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
实例
curl -X POST "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/purge_cache" \
-H "X-Auth-Email: [email protected]" \
-H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
然后再去linux系统里面创建定时任务就可以了, 具体方法请搜索.
参考
https://api.cloudflare.com/#zone-purge-all-files
https://blog.cloudflare.com/introducing-a-powerful-way-to-purge-cache-on-cloudflare-purge-by-cache-tag/
本网站所有内容版权没有, 请随意使用, 欢迎修改或转载, 无需署名, 也无需保留本链接.
清理缓存有什么用呢 一直都没清理过
有些时候删除东西的时候需要用到这个.