通过api形式关闭Cloudflare Pages的访问策略
如何通过API关闭Cloudflare Pages的访问策略?
手抖不小心点击开启”访问策略”,找不到关闭地方….
// This is disgusting
// Just tell others to keep away from the AccessPolicy from CloudflarePages
解决方案
1.curl API 获取相应的 app uuid
curl -X GET "https://api.cloudflare.com/client/v4/accounts/账户标识符/access/apps" \
-H "X-Auth-Email: 邮箱" \
-H "X-Auth-Key: Global API KEY" \
-H "Content-Type: application/json"
以下为需要修改的地方:
- 账户标识符 是登录Cloudflare后浏览器后面的一串字符如
https://dash.cloudflare.com/114514adfasdhfkhjaskfwehakgbadkf
- 邮箱 就是你的邮箱
- Global API KEY 打开 API tokens 查看并保存即可
curl后你就获取一大堆废话,这里就不贴图了。然后找到最下面的一个 uid 保存下来
“uid”:”xxxxx”
2.下一步:curl 关闭访问策略
curl -X DELETE "https://api.cloudflare.com/client/v4/accounts/账户标识符/access/apps/刚才获取的app uuid" \
-H "X-Auth-Email: 邮箱" \
-H "X-Auth-Key: Global API KEY" \
-H "Content-Type: application/json"
- GET修改为了DELETE
- 最后添加了前面获取的app uuid
最后显示如下表示大功告成
"success":true
再次查看已关闭