Cloudflare 规则相关设置项位置在 缓存 - Cache Rules,清除缓存的选项在 缓存 - 配置。
建议搭配 Halo 的 CDN 缓存刷新插件使用,实现内容更新时自动刷新缓存。
bypass 规则
务必放在规则列表首位
http.host eq "www.sundaydream.top" and (
starts_with(http.request.uri.path, "/console") or
starts_with(http.request.uri.path, "/api") or
starts_with(http.request.uri.path, "/apis") or
starts_with(http.request.uri.path, "/actuator") or
starts_with(http.request.uri.path, "/uc") or
starts_with(http.request.uri.path, "/feed") or
starts_with(http.request.uri.path, "/rss") or
starts_with(http.request.uri.path, "/sitemap") or
starts_with(http.request.uri.path, "/oauth2") or
starts_with(http.request.uri.path, "/metrics") or
starts_with(http.request.uri.path, "/admin") or
starts_with(http.request.uri.path, "/login") or
starts_with(http.request.uri.path, "/logout") or
starts_with(http.request.uri.path, "/search") or
http.request.uri.path contains "login" or
http.request.uri.path contains "logout" or
http.request.uri.path contains "search"
)
全站缓存规则
http.host eq "www.sundaydream.top"
只写这个不生效,会导致全站都被缓存,请使用下面的版本
http.host eq "www.sundaydream.top" and not (
starts_with(http.request.uri.path, "/console") or
starts_with(http.request.uri.path, "/api") or
starts_with(http.request.uri.path, "/apis") or
starts_with(http.request.uri.path, "/actuator") or
starts_with(http.request.uri.path, "/uc") or
starts_with(http.request.uri.path, "/feed") or
starts_with(http.request.uri.path, "/rss") or
starts_with(http.request.uri.path, "/sitemap") or
starts_with(http.request.uri.path, "/oauth2") or
starts_with(http.request.uri.path, "/metrics") or
starts_with(http.request.uri.path, "/admin") or
starts_with(http.request.uri.path, "/login") or
starts_with(http.request.uri.path, "/logout") or
starts_with(http.request.uri.path, "/search") or
http.request.uri.path contains "login" or
http.request.uri.path contains "logout" or
http.request.uri.path contains "search"
)
请根据实际将域名替换为自己的域名。