1. 服务器/VPS/主机用户Telegram电报群: https://t.me/openos
    黑群晖 Synology Telegram电报群: https://t.me/nasfan
    排除公告

Cloudflare使用API清理所有缓存

本帖由 post2020-11-23 发布。版面名称:服务器论坛

  1. post

    post New Member

    注册:
    2019-10-24
    帖子:
    465
    使用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/introdu...purge-cache-on-cloudflare-purge-by-cache-tag/