Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/masx200_deno_http_middleware/mod.ts>CorsOptions

Deno 原生 HTTP 服务器的中间件框架
Go to Latest
interface CorsOptions
Re-export
import { type CorsOptions } from "https://deno.land/x/masx200_deno_http_middleware@2.2.2/mod.ts";

Properties

optional
origin: string | ((ctx: Context) => string | false | Promise<string | false>)

Access-Control-Allow-Origin, default is request Origin header

optional
allowMethods: string | string[] | null

Access-Control-Allow-Methods, default is 'GET,HEAD,PUT,POST,DELETE,PATCH'

optional
exposeHeaders: string | string[]

Access-Control-Expose-Headers

optional
allowHeaders: string | string[]

Access-Control-Allow-Headers

optional
maxAge: string | number

Access-Control-Max-Age in seconds

optional
credentials: boolean | ((ctx: Context) => boolean | Promise<boolean>)

Access-Control-Allow-Credentials

optional
secureContext: boolean

Cross-Origin-Opener-Policy & Cross-Origin-Embedder-Policy headers.', default is false.

optional
privateNetworkAccess: boolean

Handle Access-Control-Request-Private-Network request by return Access-Control-Allow-Private-Network, default to false