v32

latestOpenAPI 3.1.0raw.githubusercontent.com2026-05-151,1412,2144.5 MB
Rules

Change rule

put/cdn/resources/{resource_id}/rules/{rule_id}

Path parameters

resource_idinteger required

CDN resource ID.

rule_idinteger required

Rule ID.

Request body

activeboolean

Enables or disables a rule.

Possible values:

  • true - Rule is active, rule settings are applied.
  • false - Rule is inactive, rule settings are not applied.
namestring

Rule name.

rulestring required

Path to the file or folder for which the rule will be applied.

The rule is applied if the requested URI matches the rule path.

We add a leading forward slash to any rule path. Specify a path without a forward slash.

ruleTypeinteger required

Rule type.

Possible values:

  • Type 0 - Regular expression. Must start with '^/' or '/'.
  • Type 1 - Regular expression. Note that for this rule type we automatically add / to each rule pattern before your regular expression. This type is legacy, please use Type 0.
weightinteger

Rule execution order: from lowest (1) to highest.

If requested URI matches multiple rules, the one higher in the order of the rules will be applied.

overrideOriginProtocol'HTTPS' | 'HTTP' | 'MATCH' nullable

Sets a protocol other than the one specified in the CDN resource settings to connect to the origin.

Possible values:

  • HTTPS - CDN servers connect to origin via HTTPS protocol.
  • HTTP - CDN servers connect to origin via HTTP protocol.
  • MATCH - Connection protocol is chosen automatically; in this case, content on origin source should be available for the CDN both through HTTP and HTTPS protocols.
  • null - originProtocol setting is inherited from the CDN resource settings.
originGroupinteger nullable

ID of the origin group to which the rule is applied.

If the origin group is not specified, the rule is applied to the origin group that the CDN resource is associated with.

Example request

{
  "active": true,
  "name": "My first rule",
  "rule": "/folder/images/*.png",
  "weight": 1,
  "options": {
    "allowedHttpMethods": {
      "enabled": true,
      "value": [
        "GET",
        "POST"
      ]
    },
    "brotli_compression": {
      "enabled": true,
      "value": [
        "text/html",
        "text/plain"
      ]
    },
    "browser_cache_settings": {
      "enabled": true,
      "value": "3600s"
    },
    "cache_http_headers": {
      "enabled": false,
      "value": [
        "vary",
        "content-length",
        "last-modified",
        "connection",
        "accept-ranges",
        "content-type",
        "content-encoding",
        "etag",
        "cache-control",
        "expires",
        "keep-alive",
        "server"
      ]
    },
    "cors": {
      "enabled": true,
      "value": [
        "domain.com",
        "domain2.com"
      ],
      "always": true
    },
    "country_acl": {
      "enabled": true,
      "policy_type": "allow",
      "excepted_values": [
        "GB",
        "DE"
      ]
    },
    "disable_cache": {
      "enabled": true,
      "value": false
    },
    "disable_proxy_force_ranges": {
      "enabled": true,
      "value": true
    },
    "edge_cache_settings": {
      "enabled": true,
      "value": "43200s",
      "custom_values": {
        "100": "43200s"
      }
    },
    "fastedge": {
      "enabled": true,
      "on_request_headers": {
        "enabled": true,
        "app_id": "1001",
        "interrupt_on_error": true
      }
    },
    "fetch_compressed": {
      "enabled": true,
      "value": false
    },
    "follow_origin_redirect": {
      "enabled": true,
      "codes": [
        302,
        308
      ]
    },
    "force_return": {
      "enabled": true,
      "code": 301,
      "body": "http://example.com/redirect_address",
      "time_interval": {
        "start_time": "09:00",
        "end_time": "20:00",
        "time_zone": "CET"
      }
    },
    "forward_host_header": {
      "enabled": false,
      "value": false
    },
    "gzipOn": {
      "enabled": true,
      "value": true
    },
    "hostHeader": {
      "enabled": true,
      "value": "host.com"
    },
    "ignore_cookie": {
      "enabled": true,
      "value": true
    },
    "ignoreQueryString": {
      "enabled": true,
      "value": false
    },
    "image_stack": {
      "enabled": true,
      "avif_enabled": true,
      "webp_enabled": false,
      "quality": 80,
      "png_lossless": true
    },
    "ip_address_acl": {
      "enabled": true,
      "policy_type": "deny",
      "excepted_values": [
        "192.168.1.100/32"
      ]
    },
    "limit_bandwidth": {
      "enabled": true,
      "limit_type": "static",
      "speed": 100,
      "buffer": 200
    },
    "proxy_cache_key": {
      "enabled": true,
      "value": "$scheme$uri"
    },
    "proxy_cache_methods_set": {
      "enabled": true,
      "value": false
    },
    "proxy_connect_timeout": {
      "enabled": true,
      "value": "4s"
    },
    "proxy_read_timeout": {
      "enabled": true,
      "value": "10s"
    },
    "query_params_blacklist": {
      "enabled": true,
      "value": [
        "some",
        "blacklisted",
        "query"
      ]
    },
    "query_params_whitelist": {
      "enabled": true,
      "value": [
        "some",
        "whitelisted",
        "query"
      ]
    },
    "query_string_forwarding": {
      "enabled": true,
      "forward_from_file_types": [
        "m3u8",
        "mpd"
      ],
      "forward_to_file_types": [
        "ts",
        "mp4"
      ],
      "forward_only_keys": [
        "auth_token",
        "session_id"
      ],
      "forward_except_keys": [
        "debug_info"
      ]
    },
    "redirect_http_to_https": {
      "enabled": true,
      "value": true
    },
    "redirect_https_to_http": {
      "enabled": false,
      "value": true
    },
    "referrer_acl": {
      "enabled": true,
      "policy_type": "deny",
      "excepted_values": [
        "example.com",
        "*.example.net"
      ]
    },
    "response_headers_hiding_policy": {
      "enabled": true,
      "mode": "hide",
      "excepted": [
        "my-header"
      ]
    },
    "rewrite": {
      "enabled": true,
      "body": "/(.*) /additional_path/$1",
      "flag": "break"
    },
    "secure_key": {
      "enabled": true,
      "key": "secretkey",
      "type": 2
    },
    "slice": {
      "enabled": true,
      "value": true
    },
    "sni": {
      "enabled": true,
      "sni_type": "custom",
      "custom_hostname": "custom.example.com"
    },
    "stale": {
      "enabled": true,
      "value": [
        "http_404",
        "http_500"
      ]
    },
    "static_response_headers": {
      "enabled": true,
      "value": [
        {
          "name": "X-Example",
          "value": [
            "Value_1"
          ],
          "always": true
        },
        {
          "name": "X-Example-Multiple",
          "value": [
            "Value_1",
            "Value_2",
            "Value_3"
          ],
          "always": false
        }
      ]
    },
    "staticHeaders": {
      "enabled": true,
      "value": {
        "X-Example": "Value_1",
        "X-Example-Multiple": [
          "Value_2",
          "Value_3"
        ]
      }
    },
    "staticRequestHeaders": {
      "enabled": true,
      "value": {
        "Header-One": "Value 1",
        "Header-Two": "Value 2"
      }
    },
    "user_agent_acl": {
      "enabled": true,
      "policy_type": "allow",
      "excepted_values": [
        "UserAgent Value",
        "~*.*bot.*",
        ""
      ]
    },
    "waap": {
      "enabled": true,
      "value": true
    },
    "websockets": {
      "enabled": true,
      "value": true
    }
  }
}

Response

Successful.

idinteger

Rule ID.

namestring

Rule name.

activeboolean

Enables or disables a rule.

Possible values:

  • true - Rule is active, rule settings are applied.
  • false - Rule is inactive, rule settings are not applied.
deletedboolean

Defines whether the rule has been deleted.

Possible values:

  • true - Rule has been deleted.
  • false - Rule has not been deleted.
originGroupinteger nullable

ID of the origin group to which the rule is applied.

If the origin group is not specified, the rule is applied to the origin group that the CDN resource is associated with.

rulestring

Path to the file or folder for which the rule will be applied.

The rule is applied if the requested URI matches the rule path.

We add a leading forward slash to any rule path. Specify a path without a forward slash.

ruleTypeinteger

Rule type.

Possible values:

  • Type 0 - Regular expression. Must start with '^/' or '/'.
  • Type 1 - Regular expression. Note that for this rule type we automatically add / to each rule pattern before your regular expression. This type is legacy, please use Type 0.
weightinteger

Rule execution order: from lowest (1) to highest.

If requested URI matches multiple rules, the one higher in the order of the rules will be applied.

originProtocol'HTTPS' | 'HTTP' | 'MATCH'

Protocol used by CDN servers to request content from an origin source.

Possible values:

  • HTTPS - CDN servers connect to origin via HTTPS protocol.
  • HTTP - CDN servers connect to origin via HTTP protocol.
  • MATCH - Connection protocol is chosen automatically; in this case, content on origin source should be available for the CDN both through HTTP and HTTPS protocols.
overrideOriginProtocol'HTTPS' | 'HTTP' | 'MATCH' nullable

Sets a protocol other than the one specified in the CDN resource settings to connect to the origin.

Possible values:

  • HTTPS - CDN servers connect to origin via HTTPS protocol.
  • HTTP - CDN servers connect to origin via HTTP protocol.
  • MATCH - Connection protocol is chosen automatically; in this case, content on origin source should be available for the CDN both through HTTP and HTTPS protocols.
  • null - originProtocol setting is inherited from the CDN resource settings.
preset_appliedboolean

Defines whether the rule has an applied preset.

Possible values:

  • true - Rule has a preset applied.
  • false - Rule does not have a preset applied.

If a preset is applied to the rule, the options included in the preset cannot be edited for the rule.

primary_ruleinteger nullable

ID of the rule with which the current rule is synchronized within the CDN resource shared cache zone feature.

Example response

{
  "id": 5,
  "name": "My first rule",
  "active": true,
  "rule": "/folder/images/*.png",
  "weight": 1,
  "originProtocol": "HTTPS",
  "options": {
    "allowedHttpMethods": {
      "enabled": true,
      "value": [
        "GET",
        "POST"
      ]
    },
    "brotli_compression": {
      "enabled": true,
      "value": [
        "text/html",
        "text/plain"
      ]
    },
    "browser_cache_settings": {
      "enabled": true,
      "value": "3600s"
    },
    "cache_http_headers": {
      "enabled": false,
      "value": [
        "vary",
        "content-length",
        "last-modified",
        "connection",
        "accept-ranges",
        "content-type",
        "content-encoding",
        "etag",
        "cache-control",
        "expires",
        "keep-alive",
        "server"
      ]
    },
    "cors": {
      "enabled": true,
      "value": [
        "domain.com",
        "domain2.com"
      ],
      "always": true
    },
    "country_acl": {
      "enabled": true,
      "policy_type": "allow",
      "excepted_values": [
        "GB",
        "DE"
      ]
    },
    "disable_cache": {
      "enabled": true,
      "value": false
    },
    "disable_proxy_force_ranges": {
      "enabled": true,
      "value": true
    },
    "edge_cache_settings": {
      "enabled": true,
      "value": "43200s",
      "custom_values": {
        "100": "43200s"
      }
    },
    "fastedge": {
      "enabled": true,
      "on_request_headers": {
        "enabled": true,
        "app_id": "1001",
        "interrupt_on_error": true
      }
    },
    "fetch_compressed": {
      "enabled": true,
      "value": false
    },
    "follow_origin_redirect": {
      "enabled": true,
      "codes": [
        302,
        308
      ]
    },
    "force_return": {
      "enabled": true,
      "code": 301,
      "body": "http://example.com/redirect_address",
      "time_interval": {
        "start_time": "09:00",
        "end_time": "20:00",
        "time_zone": "CET"
      }
    },
    "forward_host_header": {
      "enabled": false,
      "value": false
    },
    "gzipOn": {
      "enabled": true,
      "value": true
    },
    "hostHeader": {
      "enabled": true,
      "value": "host.com"
    },
    "ignore_cookie": {
      "enabled": true,
      "value": true
    },
    "ignoreQueryString": {
      "enabled": true,
      "value": false
    },
    "image_stack": {
      "enabled": true,
      "avif_enabled": true,
      "webp_enabled": false,
      "quality": 80,
      "png_lossless": true
    },
    "ip_address_acl": {
      "enabled": true,
      "policy_type": "deny",
      "excepted_values": [
        "192.168.1.100/32"
      ]
    },
    "limit_bandwidth": {
      "enabled": true,
      "limit_type": "static",
      "speed": 100,
      "buffer": 200
    },
    "proxy_cache_key": {
      "enabled": true,
      "value": "$scheme$uri"
    },
    "proxy_cache_methods_set": {
      "enabled": true,
      "value": false
    },
    "proxy_connect_timeout": {
      "enabled": true,
      "value": "4s"
    },
    "proxy_read_timeout": {
      "enabled": true,
      "value": "10s"
    },
    "query_params_blacklist": {
      "enabled": true,
      "value": [
        "some",
        "blacklisted",
        "query"
      ]
    },
    "query_params_whitelist": {
      "enabled": true,
      "value": [
        "some",
        "whitelisted",
        "query"
      ]
    },
    "query_string_forwarding": {
      "enabled": true,
      "forward_from_file_types": [
        "m3u8",
        "mpd"
      ],
      "forward_to_file_types": [
        "ts",
        "mp4"
      ],
      "forward_only_keys": [
        "auth_token",
        "session_id"
      ],
      "forward_except_keys": [
        "debug_info"
      ]
    },
    "redirect_http_to_https": {
      "enabled": true,
      "value": true
    },
    "redirect_https_to_http": {
      "enabled": false,
      "value": true
    },
    "referrer_acl": {
      "enabled": true,
      "policy_type": "deny",
      "excepted_values": [
        "example.com",
        "*.example.net"
      ]
    },
    "response_headers_hiding_policy": {
      "enabled": true,
      "mode": "hide",
      "excepted": [
        "my-header"
      ]
    },
    "rewrite": {
      "enabled": true,
      "body": "/(.*) /additional_path/$1",
      "flag": "break"
    },
    "secure_key": {
      "enabled": true,
      "key": "secretkey",
      "type": 2
    },
    "slice": {
      "enabled": true,
      "value": true
    },
    "sni": {
      "enabled": true,
      "sni_type": "custom",
      "custom_hostname": "custom.example.com"
    },
    "stale": {
      "enabled": true,
      "value": [
        "http_404",
        "http_500"
      ]
    },
    "static_response_headers": {
      "enabled": true,
      "value": [
        {
          "name": "X-Example",
          "value": [
            "Value_1"
          ],
          "always": true
        },
        {
          "name": "X-Example-Multiple",
          "value": [
            "Value_1",
            "Value_2",
            "Value_3"
          ],
          "always": false
        }
      ]
    },
    "staticHeaders": {
      "enabled": true,
      "value": {
        "X-Example": "Value_1",
        "X-Example-Multiple": [
          "Value_2",
          "Value_3"
        ]
      }
    },
    "staticRequestHeaders": {
      "enabled": true,
      "value": {
        "Header-One": "Value 1",
        "Header-Two": "Value 2"
      }
    },
    "user_agent_acl": {
      "enabled": true,
      "policy_type": "allow",
      "excepted_values": [
        "UserAgent Value",
        "~*.*bot.*",
        ""
      ]
    },
    "waap": {
      "enabled": true,
      "value": true
    },
    "websockets": {
      "enabled": true,
      "value": true
    }
  }
}