Skip to Content

CORS

On the Buildpad Engine backend, there are two sets of cross-origin rules:

  • The Engine’s rules apply to the API on the Engine’s URL. The browser that shows the Studio calls the Engine from the Studio’s origin, so the Engine’s rules must accept that origin. The Engine reads its rules from its settings (Settings → CORS), then from its own CORS_ALLOWED_ORIGINS and CORS_ALLOW_CREDENTIALS, then from its default.
  • The Studio’s rules apply only to the routes that the Studio’s own server serves, such as /api/env and /api/assets/:id. On this backend the Studio reads them from its CORS_* environment variables only.

The Engine applies the host’s rules to every request. Change them as an administrator of the host. Inside a tenant, the Studio does not show Settings → CORS. The CORS tab is not in the list. If you open /settings/cors, the page tells you that the rules are set in the host, and it shows no form. To change the rules, switch to the host. The Engine also refuses a change from a tenant with 403.

The rest of this page is for the Supabase backend.

CORS headers are applied to all /api/* routes by the root middleware (proxy.ts).

CORS is configured at runtime in Settings → CORS (stored in daas_settings) — the middleware prefers those values and caches them for 60 seconds. The CORS_* environment variables are a fallback only, used when the settings row cannot be read (e.g., before migrations have run). On a migrated deployment, change origins in Settings → CORS, not via env vars.

Databases whose settings row predates the CORS-defaults fix (migration 20260319000001_fix_cors_defaults.sql, shipped in v0.1.30) may still contain the legacy wildcard * in cors_origins — that migration deliberately leaves existing rows unchanged. Review Settings → CORS and set explicit origins.

In the env-var fallback, CORS_ORIGINS defaults to empty, which blocks all cross-origin requests. You must explicitly list allowed origins for production.

Common Configurations

Enter origins in Settings → CORS → Allowed Origins (type an origin and press Enter to add it). The env form shown alongside each example applies only as the pre-migration fallback.

Allow a specific domain

Add https://app.example.com to Allowed Origins.

CORS_ORIGINS=https://app.example.com

Allow multiple domains

Add https://app.example.com and https://admin.example.com to Allowed Origins.

CORS_ORIGINS=https://app.example.com,https://admin.example.com

Allow wildcard subdomains

Add *.example.com to Allowed Origins.

CORS_ORIGINS=*.example.com

Add the explicit origin to Allowed Origins and enable Allow Credentials.

CORS_ORIGINS=https://app.example.com CORS_ALLOW_CREDENTIALS=true

When credentials are allowed, the Origin header is echoed back instead of *. The wildcard * is incompatible with credentials: include. Always use explicit origins when credentials are enabled.

Disable CORS entirely (same-origin only)

Turn off Enable CORS in Settings → CORS.

CORS_ENABLED=false

All Variables

See Environment Variables for the full fallback variable reference.