Skip to content

CorsOptions

Defined in: types.ts:212

Normalized CORS option shape shared by @mantlejs/express, @mantlejs/koa, and @mantlejs/http so switching transports doesn’t require relearning CORS configuration. Each transport translates this into its own mechanism — the cors package, @koa/cors, or hand-rolled headers for @mantlejs/http.

optional allowedHeaders?: string[]

Defined in: types.ts:218

Allowed request headers for Access-Control-Allow-Headers. Default: reflects Access-Control-Request-Headers.


optional credentials?: boolean

Defined in: types.ts:222

Allow credentials (cookies, Authorization header) cross-origin. Default: false.


optional exposedHeaders?: string[]

Defined in: types.ts:220

Headers exposed to the browser via Access-Control-Expose-Headers.


optional maxAge?: number

Defined in: types.ts:224

How long, in seconds, browsers may cache a preflight response (Access-Control-Max-Age).


optional methods?: string[]

Defined in: types.ts:216

Allowed methods for Access-Control-Allow-Methods. Default: ["GET", "POST", "PUT", "PATCH", "DELETE"].


optional origin?: string | boolean | string[] | ((requestOrigin) => string | boolean)

Defined in: types.ts:214

Allowed origin(s) for Access-Control-Allow-Origin. true reflects the request’s Origin header. Default: true.