PATCH
/
cdn
/
resources
/
{resource_id}
Change CDN resource
curl --request PATCH \
  --url https://api.gcore.com/cdn/resources/{resource_id} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "active": true,
  "name": "Resource for images",
  "description": "My resource",
  "secondaryHostnames": [
    "first.example.com",
    "second.example.com"
  ],
  "originGroup": 132,
  "originProtocol": "HTTPS",
  "sslEnabled": false,
  "sslData": 192,
  "proxy_ssl_enabled": false,
  "proxy_ssl_ca": null,
  "proxy_ssl_data": null,
  "options": {
    "allowedHttpMethods": {
      "enabled": true,
      "value": [
        "GET",
        "POST"
      ]
    },
    "bot_protection": {
      "enabled": true,
      "bot_challenge": {
        "enabled": true
      }
    },
    "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": 1200,
        "time_zone": "CET"
      }
    },
    "forward_host_header": {
      "enabled": false,
      "value": false
    },
    "gzipOn": {
      "enabled": true,
      "value": true
    },
    "hostHeader": {
      "enabled": true,
      "value": "host.com"
    },
    "http3_enabled": {
      "enabled": true,
      "value": true
    },
    "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"
      ]
    },
    "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"
      ]
    },
    "request_limiter": {
      "enabled": true,
      "rate_unit": "r/s",
      "rate": 5,
      "burst": 5,
      "delay": 0
    },
    "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"
      }
    },
    "tls_versions": {
      "enabled": true,
      "value": [
        "SSLv3",
        "TLSv1.3"
      ]
    },
    "use_default_le_chain": {
      "enabled": true,
      "value": true
    },
    "use_dns01_le_challenge": {
      "enabled": true,
      "value": true
    },
    "use_rsa_le_cert": {
      "enabled": true,
      "value": true
    },
    "user_agent_acl": {
      "enabled": true,
      "policy_type": "allow",
      "excepted_values": [
        "UserAgent Value",
        ""
      ]
    },
    "websockets": {
      "enabled": true,
      "value": true
    }
  }
}'
{
  "id": 220,
  "cname": "cdn.site.com",
  "active": true,
  "enabled": true,
  "status": "active",
  "deleted": false,
  "client": 170,
  "name": "Resource for images",
  "description": "My resource",
  "created": "2017-06-10 10:30:04.954354+00:00",
  "updated": "2017-06-14 05:05:42.065221+00:00",
  "originGroup": 132,
  "originGroup_name": "Resource origin group",
  "originProtocol": "HTTPS",
  "secondaryHostnames": [
    "first.example.com",
    "second.example.com"
  ],
  "shielded": false,
  "shield_dc": null,
  "shield_enabled": false,
  "shield_routing_map": null,
  "sslEnabled": false,
  "sslData": 192,
  "proxy_ssl_enabled": false,
  "proxy_ssl_ca": null,
  "proxy_ssl_data": null,
  "preset_applied": false,
  "vp_enabled": false,
  "full_custom_enabled": false,
  "can_purge_by_urls": false,
  "suspend_date": null,
  "suspended": false,
  "primary_resource": null,
  "is_primary": null,
  "waap_domain_id": null,
  "rules": [],
  "options": {
    "allowedHttpMethods": {
      "enabled": true,
      "value": [
        "GET",
        "POST"
      ]
    },
    "bot_protection": {
      "enabled": true,
      "bot_challenge": {
        "enabled": true
      }
    },
    "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": 1200,
        "time_zone": "CET"
      }
    },
    "forward_host_header": {
      "enabled": false,
      "value": false
    },
    "gzipOn": {
      "enabled": true,
      "value": true
    },
    "hostHeader": {
      "enabled": true,
      "value": "host.com"
    },
    "http3_enabled": {
      "enabled": true,
      "value": true
    },
    "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"
      ]
    },
    "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"
      ]
    },
    "request_limiter": {
      "enabled": true,
      "rate_unit": "r/s",
      "rate": 5,
      "burst": 5,
      "delay": 0
    },
    "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"
      }
    },
    "tls_versions": {
      "enabled": true,
      "value": [
        "SSLv3",
        "TLSv1.3"
      ]
    },
    "use_default_le_chain": {
      "enabled": true,
      "value": true
    },
    "use_dns01_le_challenge": {
      "enabled": true,
      "value": true
    },
    "use_rsa_le_cert": {
      "enabled": true,
      "value": true
    },
    "user_agent_acl": {
      "enabled": true,
      "policy_type": "allow",
      "excepted_values": [
        "UserAgent Value",
        ""
      ]
    },
    "websockets": {
      "enabled": true,
      "value": true
    }
  }
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

resource_id
integer
required

CDN resource ID.

Body

application/json
active
boolean
default:true

Enables or disables a CDN resource. Possible values:

  • true - CDN resource is active. Content is being delivered.
  • false - CDN resource is deactivated. Content is not being delivered.
Example:

true

name
string | null

CDN resource name.

Example:

"Resource for images"

description
string

Optional comment describing the CDN resource.

Example:

"My resource"

secondaryHostnames
string<domain>[]

Additional delivery domains (CNAMEs) that will be used to deliver content via the CDN. Up to ten additional CNAMEs are possible.

Example:
["first.example.com", "second.example.com"]
originGroup
integer

Origin group ID with which the CDN resource is associated. You can use either the origin or originGroup parameter in the request.

Example:

132

originProtocol
enum<string>
default:HTTP

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

  • HTTPS - CDN servers will connect to the origin via HTTPS.
  • HTTP - CDN servers will connect to the origin via HTTP.
  • MATCH - connection protocol will be chosen automatically (content on the origin source should be available for the CDN both through HTTP and HTTPS). If protocol is not specified, HTTP is used to connect to an origin server.
Available options:
HTTP,
HTTPS,
MATCH
Example:

"HTTPS"

sslEnabled
boolean
default:false

Defines whether the HTTPS protocol enabled for content delivery. Possible values:

  • true - HTTPS is enabled.
  • false - HTTPS is disabled.
Example:

false

sslData
integer | null

ID of the SSL certificate linked to the CDN resource. Can be used only with "sslEnabled": true.

Example:

192

proxy_ssl_enabled
boolean
default:false

Enables or disables SSL certificate validation of the origin server before completing any connection. Possible values:

  • true - Origin SSL certificate validation is enabled.
  • false - Origin SSL certificate validation is disabled.
Example:

false

proxy_ssl_ca
integer | null

ID of the trusted CA certificate used to verify an origin. It can be used only with "proxy_ssl_enabled": true.

Example:

null

proxy_ssl_data
integer | null

ID of the SSL certificate used to verify an origin. It can be used only with "proxy_ssl_enabled": true.

Example:

null

options
object

List of options that can be configured for the CDN resource. In case of null value the option is not added to the CDN resource. Option may inherit its value from the global account settings.

Response

Successful.

id
integer

CDN resource ID.

Example:

220

cname
string

Delivery domains that will be used for content delivery through a CDN. Delivery domains should be added to your DNS settings.

Example:

"cdn.site.com"

active
boolean
default:true

Enables or disables a CDN resource. Possible values:

  • true - CDN resource is active. Content is being delivered.
  • false - CDN resource is deactivated. Content is not being delivered.
Example:

true

enabled
boolean

Enables or disables a CDN resource change by a user. Possible values:

  • true - CDN resource is enabled and can be changed. Content can be delivered.
  • false - CDN resource is disabled and cannot be changed. Content can not be delivered.
Example:

true

status
enum<string>

CDN resource status. Possible values:

  • active - CDN resource is active. Content is available to users.
  • suspended - CDN resource is suspended. Content is not available to users.
  • processed - CDN resource has recently been created and is currently being processed. It will take about fifteen minutes to propagate it to all locations.
  • deleted - CDN resource is deleted.
Available options:
active,
suspended,
processed,
deleted
Example:

"active"

deleted
string

Defines whether CDN resource has been deleted. Possible values:

  • true - CDN resource is deleted.
  • false - CDN resource is not deleted.
Example:

false

client
integer

ID of an account to which the CDN resource belongs.

Example:

170

name
string | null

CDN resource name.

Example:

"Resource for images"

description
string

Optional comment describing the CDN resource.

Example:

"My resource"

created
string

Date of CDN resource creation.

Example:

"2017-06-10 10:30:04.954354+00:00"

updated
string

Date of the last CDN resource update.

Example:

"2017-06-14 05:05:42.065221+00:00"

originGroup
integer

Origin group ID with which the CDN resource is associated. You can use either the origin or originGroup parameter in the request.

Example:

132

originGroup_name
string

Origin group name.

Example:

"Resource origin group"

originProtocol
enum<string>
default:HTTP

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

  • HTTPS - CDN servers will connect to the origin via HTTPS.
  • HTTP - CDN servers will connect to the origin via HTTP.
  • MATCH - connection protocol will be chosen automatically (content on the origin source should be available for the CDN both through HTTP and HTTPS). If protocol is not specified, HTTP is used to connect to an origin server.
Available options:
HTTP,
HTTPS,
MATCH
Example:

"HTTPS"

secondaryHostnames
string<domain>[]

Additional delivery domains (CNAMEs) that will be used to deliver content via the CDN. Up to ten additional CNAMEs are possible.

Example:
["first.example.com", "second.example.com"]
shielded
boolean

Defines whether origin shielding feature is enabled for the resource. Possible values:

  • true - Origin shielding is enabled.
  • false - Origin shielding is disabled.
Example:

false

shield_dc
string | null

Name of the origin shielding location data center. Parameter returns null if origin shielding is disabled.

Example:

null

shield_enabled
boolean

Defines whether origin shield is active and working for the CDN resource. Possible values:

  • true - Origin shield is active.
  • false - Origin shield is not active.
Example:

false

shield_routing_map
integer | null

Defines whether the origin shield with a dynamic location is enabled for the CDN resource. To manage origin shielding, you must contact customer support.

Example:

null

sslEnabled
boolean
default:false

Defines whether the HTTPS protocol enabled for content delivery. Possible values:

  • true - HTTPS is enabled.
  • false - HTTPS is disabled.
Example:

false

sslData
integer | null

ID of the SSL certificate linked to the CDN resource. Can be used only with "sslEnabled": true.

Example:

192

proxy_ssl_enabled
boolean
default:false

Enables or disables SSL certificate validation of the origin server before completing any connection. Possible values:

  • true - Origin SSL certificate validation is enabled.
  • false - Origin SSL certificate validation is disabled.
Example:

false

proxy_ssl_ca
integer | null

ID of the trusted CA certificate used to verify an origin. It can be used only with "proxy_ssl_enabled": true.

Example:

null

proxy_ssl_data
integer | null

ID of the SSL certificate used to verify an origin. It can be used only with "proxy_ssl_enabled": true.

Example:

null

preset_applied
boolean

Defines whether the CDN resource has a preset applied. Possible values:

  • true - CDN resource has a preset applied. CDN resource options included in the preset cannot be edited.
  • false - CDN resource does not have a preset applied.
Example:

false

vp_enabled
boolean

Defines whether the CDN resource is integrated with the Streaming Platform. Possible values:

  • true - CDN resource is configured for Streaming Platform. Changing resource settings can affect its operation.
  • false - CDN resource is not configured for Streaming Platform.
Example:

false

full_custom_enabled
boolean

Defines whether the CDN resource has a custom configuration. Possible values:

  • true - CDN resource has a custom configuration. You cannot change resource settings, except for the SSL certificate. To change other settings, contact technical support.
  • false - CDN resource has a regular configuration. You can change CDN resource settings.
Example:

false

can_purge_by_urls
boolean

Defines whether the CDN resource can be used for purge by URLs feature. It's available only in case the CDN resource has enabled ignore_vary_header option.

Example:

false

suspend_date
string | null

Date when the CDN resource was suspended automatically if there is no traffic on it for 90 days. Not specified if the resource was not stopped due to lack of traffic.

Example:

null

suspended
boolean

Defines whether the CDN resource has been automatically suspended because there was no traffic on it for 90 days. Possible values:

  • true - CDN resource is currently automatically suspended.
  • false - CDN resource is not automatically suspended. You can enable CDN resource using the active field. If there is no traffic on the CDN resource within seven days following activation, it will be suspended again. To avoid CDN resource suspension due to no traffic, contact technical support.
Example:

false

primary_resource
integer | null

ID of the main CDN resource which has a shared caching zone with a reserve CDN resource. If the parameter is not empty, then the current CDN resource is the reserve. You cannot change some options, create rules, set up origin shielding, or use the reserve CDN resource for Streaming.

Example:

null

is_primary
boolean | null

Defines whether a CDN resource has a cache zone shared with other CDN resources. Possible values:

  • true - CDN resource is main and has a shared caching zone with other CDN resources, which are called reserve.
  • false - CDN resource is reserve and it has a shared caching zone with the main CDN resource. You cannot change some options, create rules, set up origin shielding and use the reserve resource for Streaming.
  • null - CDN resource does not have a shared cache zone. The main CDN resource is specified in the primary_resource field. It cannot be suspended unless all related reserve CDN resources are suspended.
Example:

null

waap_domain_id
string

The ID of the associated WAAP domain.

Example:

null

rules
object[]

Rules configured for the CDN resource.

Example:
[]
options
object

List of options that can be configured for the CDN resource. In case of null value the option is not added to the CDN resource. Option may inherit its value from the global account settings.