Wildcard domains

Cloudflare Smart Connect

Connect a customer Cloudflare zone when you need wildcard publishing domains such as site.customer.com for every new StaticX site.

Advanced wildcard domains

Use Cloudflare Smart Connect when every new site should live under your own domain.

Exact custom domains can use the normal StaticX domain setup. Smart Connect is for teams that already manage a domain in Cloudflare and want StaticX to create site URLs such as client-a.example.com, landing.example.com, and campaign.example.com without adding DNS records one by one.

01

Connect Cloudflare

Start from Settings → Publishing domain. StaticX opens Cloudflare OAuth and asks only for the permissions needed to read zones, edit DNS records, and manage Worker scripts/routes.

02

Preview the install

Select the account zone, enter the publishing domain, and review the dry run. StaticX lists the wildcard DNS record, Worker script, and Worker routes before changing anything.

03

Install safely

StaticX creates only StaticX-managed resources. If a DNS record or Worker route already exists and is not managed by StaticX, the install stops and tells you what to fix.

What StaticX installs

For example.com, Smart Connect installs a proxied wildcard DNS record, a small proxy Worker, and a wildcard Worker route. If you enable apex support, it also routes example.com.

Resource Purpose Safety rule
Wildcard DNS record Routes *.example.com through the customer zone. Existing non-StaticX DNS records are never overwritten.
Worker script Forwards traffic to StaticX while preserving the original host. The script name includes the installation id to avoid collisions.
Worker route Attaches the Worker to *.example.com/*. Existing routes pointing elsewhere block the install.

Environment variables for operators

These are server-side settings. Do not expose the OAuth secret to browser code or agent prompts.

CLOUDFLARE_OAUTH_CLIENT_ID=
CLOUDFLARE_OAUTH_CLIENT_SECRET=
CLOUDFLARE_OAUTH_REDIRECT_URI=https://staticx.site/settings/domains/cloudflare/callback
CLOUDFLARE_OAUTH_SCOPES=
STATICX_EDGE_UPSTREAM_URL=https://edge.staticx.site
STATICX_CLOUDFLARE_WORKER_PREFIX=staticx-proxy

Use php artisan cloudflare:oauth-scopes during setup to inspect available Cloudflare OAuth scopes for the connected app.

Limitations

Smart Connect requires the customer domain to be active in Cloudflare. It is intentionally separate from the normal exact-domain flow and avoids Cloudflare for SaaS Enterprise wildcard custom hostnames.