Customize connection and read timeouts
Custom connection and read timeouts control how long CDB edge nodes wait when communicating with an origin server.
-
A custom connection timeout sets the maximum duration allowed for establishing a connection.
-
A custom read timeout sets the maximum time CDB edge nodes wait for the next data from the origin after a read. It does not limit the total response transmission time.
When a configured timeout is exceeded, the viewer receives a 504 Gateway Timeout response.
Configure custom timeouts
Timeouts are configured per CDN resource and apply to all requests handled by that resource.
1. In the CDB Technical Web Portal, navigate to CDN > CDN resources.

2. Click the CNAME of the required CDN resource to open Resource settings.

3. Click Custom connection timeout or Custom read timeout, depending on the timeout to configure.
4. Enable the Customize connection timeout or Customize read timeout toggle.
5. Enter the timeout value. The allowed range is 1–5 seconds for connection timeout and 1–30 seconds for read timeout. To configure both timeouts, repeat steps 3–5 for the other option before saving.
For Enterprise plans, the upper limits can be raised beyond 5 seconds (connection) and 30 seconds (read). Contact CDB Support to request higher values.

6. Click Save changes.
A slow origin holds the viewer request while Orange's CDN waits to connect or to receive the next part of the response. proxy_connect_timeout limits the wait to open the connection, and proxy_read_timeout limits the wait between successive reads, not the time for the whole response. After either limit is reached, the viewer receives a 504 Gateway Timeout response.
An API token is required. The CDN resource ID is the id from the resources list call.
export GCORE_API_KEY="{YOUR_API_KEY}"
export CDN_RESOURCE_ID="{YOUR_CDN_RESOURCE_ID}"
Set the connection timeout
Set value to a duration from 1 second through 5 seconds. enabled and value are both required.
The API accepts 4s and 4. 0s, 6s, 4S, 4sec, and 4000ms return HTTP 400.
import os
from gcore import CDB
client = CDB()
resource_id = int(os.environ["CDN_RESOURCE_ID"])
updated = client.cdn.cdn_resources.update(
resource_id,
options={"proxy_connect_timeout": {"enabled": True, "value": "4s"}},
)
print(updated.options.proxy_connect_timeout.enabled, updated.options.proxy_connect_timeout.value)
package main
import (
"context"
"fmt"
"os"
"strconv"
gcore "github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cdn"
)
func main() {
client := gcore.NewClient()
ctx := context.Background()
resourceID, err := strconv.ParseInt(os.Getenv("CDN_RESOURCE_ID"), 10, 64)
if err != nil {
panic(err)
}
updated, err := client.CDN.CDNResources.Update(ctx, resourceID, cdn.CDNResourceUpdateParams{
Options: cdn.CDNResourceUpdateParamsOptions{
ProxyConnectTimeout: cdn.CDNResourceUpdateParamsOptionsProxyConnectTimeout{
Enabled: true,
Value: "4s",
},
},
})
if err != nil {
panic(err)
}
fmt.Println(updated.Options.ProxyConnectTimeout.Enabled, updated.Options.ProxyConnectTimeout.Value)
}
curl -X PATCH "https://api.cdb-staging.cdn.orange.com/cdn/resources/$CDN_RESOURCE_ID" \
-H "Authorization: APIKey $GCORE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"options": {
"proxy_connect_timeout": {"enabled": true, "value": "4s"}
}
}'
The API returns HTTP 200. The saved option is:
{
"enabled": true,
"value": "4s"
}
Set the read timeout
Set value to a duration from 1 second through 30 seconds. enabled and value are both required. The API accepts 10s and 10. 0s, 31s, 10S, 10sec, and 10000ms return HTTP 400.
import os
from gcore import CDB
client = CDB()
resource_id = int(os.environ["CDN_RESOURCE_ID"])
updated = client.cdn.cdn_resources.update(
resource_id,
options={"proxy_read_timeout": {"enabled": True, "value": "10s"}},
)
print(updated.options.proxy_read_timeout.enabled, updated.options.proxy_read_timeout.value)
package main
import (
"context"
"fmt"
"os"
"strconv"
gcore "github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cdn"
)
func main() {
client := gcore.NewClient()
ctx := context.Background()
resourceID, err := strconv.ParseInt(os.Getenv("CDN_RESOURCE_ID"), 10, 64)
if err != nil {
panic(err)
}
updated, err := client.CDN.CDNResources.Update(ctx, resourceID, cdn.CDNResourceUpdateParams{
Options: cdn.CDNResourceUpdateParamsOptions{
ProxyReadTimeout: cdn.CDNResourceUpdateParamsOptionsProxyReadTimeout{
Enabled: true,
Value: "10s",
},
},
})
if err != nil {
panic(err)
}
fmt.Println(updated.Options.ProxyReadTimeout.Enabled, updated.Options.ProxyReadTimeout.Value)
}
curl -X PATCH "https://api.cdb-staging.cdn.orange.com/cdn/resources/$CDN_RESOURCE_ID" \
-H "Authorization: APIKey $GCORE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"options": {
"proxy_read_timeout": {"enabled": true, "value": "10s"}
}
}'
The API returns HTTP 200. The saved option is:
{
"enabled": true,
"value": "10s"
}
Set both timeouts
Send both options in one request. The call sets the connection timeout to 4s and the read timeout to 10s.
import os
from gcore import CDB
client = CDB()
resource_id = int(os.environ["CDN_RESOURCE_ID"])
updated = client.cdn.cdn_resources.update(
resource_id,
options={
"proxy_connect_timeout": {"enabled": True, "value": "4s"},
"proxy_read_timeout": {"enabled": True, "value": "10s"},
},
)
print(
updated.options.proxy_connect_timeout.value,
updated.options.proxy_read_timeout.value,
)
package main
import (
"context"
"fmt"
"os"
"strconv"
gcore "github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cdn"
)
func main() {
client := gcore.NewClient()
ctx := context.Background()
resourceID, err := strconv.ParseInt(os.Getenv("CDN_RESOURCE_ID"), 10, 64)
if err != nil {
panic(err)
}
updated, err := client.CDN.CDNResources.Update(ctx, resourceID, cdn.CDNResourceUpdateParams{
Options: cdn.CDNResourceUpdateParamsOptions{
ProxyConnectTimeout: cdn.CDNResourceUpdateParamsOptionsProxyConnectTimeout{
Enabled: true,
Value: "4s",
},
ProxyReadTimeout: cdn.CDNResourceUpdateParamsOptionsProxyReadTimeout{
Enabled: true,
Value: "10s",
},
},
})
if err != nil {
panic(err)
}
fmt.Println(updated.Options.ProxyConnectTimeout.Value, updated.Options.ProxyReadTimeout.Value)
}
curl -X PATCH "https://api.cdb-staging.cdn.orange.com/cdn/resources/$CDN_RESOURCE_ID" \
-H "Authorization: APIKey $GCORE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"options": {
"proxy_connect_timeout": {"enabled": true, "value": "4s"},
"proxy_read_timeout": {"enabled": true, "value": "10s"}
}
}'
The API returns HTTP 200. The saved options are:
{
"proxy_connect_timeout": {
"enabled": true,
"value": "4s"
},
"proxy_read_timeout": {
"enabled": true,
"value": "10s"
}
}
Turn the timeouts off
Set both options to null. The saved resource then has neither timeout. enabled set to false keeps the duration and turns that timeout off.
import os
from gcore import CDB
client = CDB()
resource_id = int(os.environ["CDN_RESOURCE_ID"])
updated = client.cdn.cdn_resources.update(
resource_id,
options={"proxy_connect_timeout": None, "proxy_read_timeout": None},
)
print(updated.options.proxy_connect_timeout, updated.options.proxy_read_timeout)
package main
import (
"context"
"fmt"
"os"
"strconv"
gcore "github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cdn"
)
func main() {
client := gcore.NewClient()
ctx := context.Background()
resourceID, err := strconv.ParseInt(os.Getenv("CDN_RESOURCE_ID"), 10, 64)
if err != nil {
panic(err)
}
options := cdn.CDNResourceUpdateParamsOptions{}
options.SetExtraFields(map[string]any{
"proxy_connect_timeout": nil,
"proxy_read_timeout": nil,
})
updated, err := client.CDN.CDNResources.Update(ctx, resourceID, cdn.CDNResourceUpdateParams{
Options: options,
})
if err != nil {
panic(err)
}
fmt.Println(updated.Options.ProxyConnectTimeout.RawJSON(), updated.Options.ProxyReadTimeout.RawJSON())
}
curl -X PATCH "https://api.cdb-staging.cdn.orange.com/cdn/resources/$CDN_RESOURCE_ID" \
-H "Authorization: APIKey $GCORE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"options": {
"proxy_connect_timeout": null,
"proxy_read_timeout": null
}
}'
The API returns HTTP 200. The saved options are:
{
"proxy_connect_timeout": null,
"proxy_read_timeout": null
}
Limit how long CDN servers wait on the origin with the Terraform provider v2. proxy_connect_timeout is the wait to open the connection, and proxy_read_timeout is the wait between successive reads. After either limit is reached, the viewer receives a 504 Gateway Timeout response. Run terraform apply after editing options.
Connection and read timeouts
Set both options enabled to true, proxy_connect_timeout value to 4s, and proxy_read_timeout value to 10s. CDN servers then wait 4 seconds to open the origin connection and 10 seconds between successive reads. Connection durations of 1s, 4s, and 5s, and read durations of 1s, 10s, and 30s, are stored in the same format.
0s returns HTTP 400: Value must be more 1. A connection value of 6s returns HTTP 400: Value must be less or equal 5s. A read value of 31s returns HTTP 400: Value must be less or equal 30s. Set enabled to false to disable a timeout while keeping the saved duration.
resource "gcore_cdn_origin_group" "example" {
name = "my-origin-group"
sources = [
{
source = "example.com"
enabled = true
}
]
}
resource "gcore_cdn_resource" "example" {
cname = "cdn.example.com"
origin_group = gcore_cdn_origin_group.example.id
origin_protocol = "HTTPS"
options = {
proxy_connect_timeout = {
enabled = true
value = "4s"
}
proxy_read_timeout = {
enabled = true
value = "10s"
}
}
}