Skip to main content

custom

Creates, updates, deletes, gets or lists a custom resource.

Overview

Namecustom
TypeResource
Idcloudflare.r2.custom

Fields

The following fields are returned by SELECT queries:

Get Custom Domain Configuration response.

NameDatatypeDescription
ciphersarrayAn allowlist of ciphers for TLS termination. These ciphers must be in the BoringSSL format.
domainstringDomain name of the custom domain to be added.
enabledbooleanWhether this bucket is publicly accessible at the specified custom domain.
minTLSstringMinimum TLS Version the custom domain will accept for incoming connections. If not set, defaults to 1.0. (1.0, 1.1, 1.2, 1.3)
statusobject
zoneIdstringZone ID of the custom domain resides in.
zoneNamestringZone that the custom domain resides in.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, bucket_name, domaincf-r2-jurisdictionGet the configuration for a custom domain on an existing R2 bucket.
listselectaccount_id, bucket_namecf-r2-jurisdictionGets a list of all custom domains registered with an existing R2 bucket.
createinsertaccount_id, bucket_name, domain, zoneId, enabledcf-r2-jurisdictionRegister a new custom domain for an existing R2 bucket.
updatereplaceaccount_id, bucket_name, domaincf-r2-jurisdictionEdit the configuration for a custom domain on an existing R2 bucket.
deletedeletebucket_name, account_id, domaincf-r2-jurisdictionRemove custom domain registration from an existing R2 bucket.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
bucket_namestringThe R2 bucket name.
domainstring
cf-r2-jurisdictionstring

SELECT examples

Get the configuration for a custom domain on an existing R2 bucket.

SELECT
ciphers,
domain,
enabled,
minTLS,
status,
zoneId,
zoneName
FROM cloudflare.r2.custom
WHERE account_id = '{{ account_id }}' -- required
AND bucket_name = '{{ bucket_name }}' -- required
AND domain = '{{ domain }}' -- required
AND cf-r2-jurisdiction = '{{ cf-r2-jurisdiction }}'
;

INSERT examples

Register a new custom domain for an existing R2 bucket.

INSERT INTO cloudflare.r2.custom (
ciphers,
domain,
enabled,
minTLS,
zoneId,
account_id,
bucket_name,
cf-r2-jurisdiction
)
SELECT
'{{ ciphers }}',
'{{ domain }}' /* required */,
{{ enabled }} /* required */,
'{{ minTLS }}',
'{{ zoneId }}' /* required */,
'{{ account_id }}',
'{{ bucket_name }}',
'{{ cf-r2-jurisdiction }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples

Edit the configuration for a custom domain on an existing R2 bucket.

REPLACE cloudflare.r2.custom
SET
ciphers = '{{ ciphers }}',
enabled = {{ enabled }},
minTLS = '{{ minTLS }}'
WHERE
account_id = '{{ account_id }}' --required
AND bucket_name = '{{ bucket_name }}' --required
AND domain = '{{ domain }}' --required
AND cf-r2-jurisdiction = '{{ cf-r2-jurisdiction}}'
RETURNING
errors,
messages,
result,
success;

DELETE examples

Remove custom domain registration from an existing R2 bucket.

DELETE FROM cloudflare.r2.custom
WHERE bucket_name = '{{ bucket_name }}' --required
AND account_id = '{{ account_id }}' --required
AND domain = '{{ domain }}' --required
AND cf-r2-jurisdiction = '{{ cf-r2-jurisdiction }}'
;