Cloudflare 新功能 Snippets 防cc规则
检查Cookie里是否有访问者IP 能防一些攻击吧
付费Pro才能用
Workers有次数限制(不防CC) 还按量收费(这个开PRO就能免费用)
Workers有次数限制(不防CC) 还按量收费(这个开PRO就能免费用)
Workers有次数限制(不防CC) 还按量收费(这个开PRO就能免费用
// 在下方输入片段代码
export default {
async fetch(request) {
let cookies = request.headers.get('Cookie') || "";
if (cookies.includes(request.headers.get("CF-Connecting-IP"))) {
return await fetch(request);
}
const newResponse = new Response(request.headers.get("CF-Connecting-IP"), {
status: 302
});
newResponse.headers.append("Set-Cookie", "ip=" + request.headers.get("CF-Connecting-IP") +"; Path=/");
newResponse.headers.append("Location", request.url);
return newResponse;
},
};
网友们可以测试一下,看看实际有没有效果
版权声明:
作者:wkweb
链接:https://www.wkweb.cn/2379.html
来源:哇咔资源网
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
海报
Cloudflare 新功能 Snippets 防cc规则
检查Cookie里是否有访问者IP 能防一些攻击吧付费Pro才能用
Workers有次数限制(不防CC) 还按量收费(这个开PRO就能免费用)
Worke……
共有 0 条评论