|
@@ -223,7 +223,18 @@ func Proto2GoPageRule(rule *zone.PageRule) (*cloudflare.PageRule, error) {
|
|
|
action []cloudflare.PageRuleAction
|
|
|
)
|
|
|
//TTL设置
|
|
|
- if rule.Ttl != nil {
|
|
|
+ if rule.Ttl == nil {
|
|
|
+ //缓存级别
|
|
|
+ action = append(action, cloudflare.PageRuleAction{
|
|
|
+ ID: "cache_level",
|
|
|
+ Value: "bypass",
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ //缓存级别
|
|
|
+ action = append(action, cloudflare.PageRuleAction{
|
|
|
+ ID: "cache_level",
|
|
|
+ Value: "cache_everything",
|
|
|
+ })
|
|
|
action = append(action, cloudflare.PageRuleAction{
|
|
|
ID: "edge_cache_ttl",
|
|
|
Value: rule.Ttl,
|
|
@@ -286,12 +297,6 @@ func Proto2GoPageRule(rule *zone.PageRule) (*cloudflare.PageRule, error) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- //缓存级别 恒为缓存所有
|
|
|
- action = append(action, cloudflare.PageRuleAction{
|
|
|
- ID: "cache_level",
|
|
|
- Value: "cache_everything",
|
|
|
- })
|
|
|
-
|
|
|
return &cloudflare.PageRule{
|
|
|
Targets: []cloudflare.PageRuleTarget{
|
|
|
{
|