记录一下我的常用设置
页面规则
这里用来缓存图床(Worker+R2+D1实现)里的图片
进入托管的域名,点击左侧菜单 规则
-> 页面规则
->点击页面中的 创建页面规则
按钮来创建如下规则:
Web应用程序防火墙
这里用来做防盗链
进入托管的域名,点击左侧菜单 安全性
-> WAF
-> 选择 自定义规则
-> 点击页面中的 创建规则
按钮来创建如下规则(免费版只能创建5条速率限制规则):
根据表达式中设置的主机名和引用方来判断是否阻止访问
(http.host eq "你的主机名" and not (
http.referer eq "你的引用方1" or
http.referer eq "你的引用方2"
))
速率限制
这里设置访问速率限制
进入托管的域名,点击左侧菜单 安全性
-> WAF
-> 选择 速率限制规则
-> 点击页面中的 创建规则
按钮来创建如下规则(免费版只能创建1条速率限制规则):
Cache Rules
这里设置
Halo
博客缓存规则(不知道什么原因没有生效,先记录一下。原因:Cloudflare 默认不会缓存带有 Cookie 的请求头)
进入托管的域名,点击左侧菜单 缓存
-> Cache Rules
-> 点击页面中的 创建规则
按钮来创建如下规则(免费版只能创建10条):
根据 Halo
定制以下规则表达式:
(
http.host contains "blog.timoxo.top"
and
(
http.request.uri.path wildcard r"*.js" or
http.request.uri.path wildcard r"*.css" or
http.request.uri.path wildcard r"*.png" or
http.request.uri.path wildcard r"*.jpg" or
http.request.uri.path wildcard r"*.jpeg" or
http.request.uri.path wildcard r"*.gif" or
http.request.uri.path wildcard r"*.svg" or
http.request.uri.path wildcard r"*.ico" or
http.request.uri.path wildcard r"*.woff2"
)
and
(
starts_with(http.request.uri.path, "/themes/") or
starts_with(http.request.uri.path, "/upload/")
)
)