Configure

CORS

Let a browser app on another domain call the Kanesh API with a bearer token.

A browser blocks calls from app.example.com to api.example.com unless the API allows that origin. CORS is off by default. Server code, scripts and agents do not need it.

Turn it on

VariableDefaultWhat it does
CORS_ENABLEDfalsetrue allows the origins below.
CORS_ORIGINSunsetExact origins, comma-separated, such as https://app.example.com,http://localhost:5173. No wildcards, no paths.

Fine-tune

The defaults fit most apps. Change them only when your app needs more.

VariableDefaultWhat it does
CORS_METHODSGET,POST,PUT,PATCH,DELETEHTTP methods the browser may use.
CORS_HEADERSAuthorization,Content-Type,If-Match,If-None-Match,X-Request-ID,X-Workspace-IDRequest headers the browser may send.
CORS_EXPOSE_HEADERSETag,X-Request-ID,X-Response-Time,Retry-After,Content-DispositionResponse headers your code can read.
CORS_MAX_AGE10mHow long the browser caches the preflight check.

You can also manage CORS in Settings → Security, where changes apply without a restart. A variable that is set wins over Studio and shows as read-only there, even when it equals the default.

Note: Cross-origin requests must use a bearer token. Cookies are never allowed across origins, and sign-in (POST /api/v1/auth/login) from another origin returns 403 access_denied. Get the token on your own server, or use a personal token.

Next steps

Buy me a coffee