CorsOptions
Options of security.cors.
Options of security.cors.
Import#
ts
import type { CorsOptions } from "@shadow-js/dusk/server";
Signature#
ts
interface CorsOptions {
/** Origins that may read API responses, as `https://app.example`. */
readonly origins: readonly string[];
/** Methods a preflight may ask for. Default `GET, HEAD, POST, PUT, PATCH, DELETE`. */
readonly methods?: readonly string[];
/** Request headers a preflight may send. Default: none beyond the simple headers. */
readonly headers?: readonly string[];
/** Whether listed origins may send credentials (cookies, authorization). Default false. */
readonly credentials?: boolean;
/** Seconds a browser may cache a preflight answer. Default 600. */
readonly maxAgeSeconds?: number;
}
Members#
| Name | Type | Description |
|---|---|---|
origins |
readonly origins: readonly string[] |
Origins that may read API responses, as https://app.example. |
methods? |
readonly methods?: readonly string[] |
Methods a preflight may ask for. Default GET, HEAD, POST, PUT, PATCH, DELETE. |
headers? |
readonly headers?: readonly string[] |
Request headers a preflight may send. Default: none beyond the simple headers. |
credentials? |
readonly credentials?: boolean |
Whether listed origins may send credentials (cookies, authorization). Default false. |
maxAgeSeconds? |
readonly maxAgeSeconds?: number |
Seconds a browser may cache a preflight answer. Default 600. |