Skip to main content

CORSOptions

Overview

Usage

import { CORSOptions } from 'keywork/http/functions'

Properties

allowedHeaders

optional allowedHeaders: `string`[]

Used in response to a preflight request to indicate which HTTP headers can be used when making the actual request.

Defaults to reflecting the headers specified in the incoming request's Access-Control-Request-Headers header.

Defined in

http/functions/cors.ts:45

allowedMethods

allowedMethods: [`HTTPMethod`](../types/HTTPMethod.mdx)[]

Defined in

http/functions/cors.ts:37

allowedOrigins

allowedOrigins: `AllowedOrigins`

Default Value

Any origin '*'

Defined in

http/functions/cors.ts:36

cachePreflightDuration

cachePreflightDuration: `number`

If provided, preflight responses can be cached for subsequent requests made to the same URL using the Access-Control-Max-Age header. The value is in seconds.

Default Value

DURATION_ONE_DAY

Defined in

http/functions/cors.ts:54

exposeHeaders

exposeHeaders: `string`[]

Indicates which headers can be exposed as part of the response by listing their names.

Default Value

CORS-safelisted_response_header

See

Defined in

http/functions/cors.ts:66

includeCredentials

includeCredentials: `boolean`

If true, allows credentials to be sent with the request. Credentials are cookies, authorization headers, or TLS client certificates.

Default Value

false

Defined in

http/functions/cors.ts:60