Set CDN geo-filtering for a custom domain
const url = 'https://api.deploybase.eu/api/v1/api/v1/domains/example/geo-filter';const options = { method: 'PATCH', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"geo_countries":["example"],"geo_mode":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.deploybase.eu/api/v1/api/v1/domains/example/geo-filter \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "geo_countries": [ "example" ], "geo_mode": "example" }'Sets a per-country allow/block policy on the domain’s dedicated pull zone. Only available for domains on a dedicated pull zone.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Domain ID
Request Body
Section titled “ Request Body ”Geo filter policy
object
GeoCountries are ISO-3166-1 alpha-2 codes (e.g. [“DE”,“FR”]). Required unless mode is off.
GeoMode is the policy: “off”, “allowlist” (only these countries reach the site) or “blocklist” (these countries are blocked, everyone else allowed).
Example generated
{ "geo_countries": [ "example" ], "geo_mode": "example"}Responses
Section titled “ Responses ”OK
object
object
object
DebugURL links to an external Let’s Encrypt diagnostic (Let’s Debug) pre-filled for this hostname, so a developer can self-check CAA/DNS issues we don’t probe server-side. Present only while SSL is unresolved (failed/pending/provisioning).
object
Record host
Human-readable guidance
CNAME | ALIAS | TXT
Record value/target
GeoMode + GeoCountries hold the CDN geo-filtering policy (BACK-210). GeoCountries is the set the customer chose (allow set or block set per GeoMode), NOT the inverted Bunny list; the block-list sent to Bunny is derived on the fly by ComputeBlockedCountries. Effective only when the domain is on a dedicated pull zone (UsesDedicatedPullZone()).
NextRetryAt is when the worker will next automatically re-attempt a failed SSL provisioning, so the UI can show “still retrying, next attempt ~X” instead of a frozen failure. Computed from the last attempt + the worker’s backoff; omitted unless failed.
PullZoneID is the dedicated Bunny pull zone for this custom domain in the 1:1 architecture (BACK-197/198), set at creation. NULL only when the CDN isn’t configured (dev/mock), in which case the domain has no CDN serving and falls back to the shared-PZ DNS instructions (see PointingTarget).
NOTE: the explicit column tag is REQUIRED — GORM’s default namer mangles “SSLAttempts” to
“s_slattempts” (it treats the embedded “SLA” as a known initialism), which doesn’t match the
ssl_attempts column created in migration 000055. Without it every domains write fails with
column "s_slattempts" does not exist. The other SSL* fields don’t collide, so only this one
needs the override.
Machine-readable failure reason (SSLErrorCode); drives reason-specific UI guidance
SupportsGeoFiltering reports whether the domain is on a dedicated pull zone and can therefore accept a CDN geo-filtering policy (BACK-210). The UI uses this to enable/disable the geo controls and explain that a legacy (shared-PZ) domain isn’t eligible yet.
Example
{ "data": { "connection_mode": "byo_dns", "geo_mode": "off", "ssl_status": "pending", "status": "pending_verification" }}Invalid mode or country code
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Unauthorized
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Not Found
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Domain not on a dedicated pull zone yet
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Saved but not applied to CDN
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}