cors
cors: (
options?) =>Function
Defined in: http/cors.js:46
Creates a CORS validation middleware.
Parameters
Section titled “Parameters”options?
Section titled “options?”CORS policy options forwarded to lib/cors
allowCredentials?
Section titled “allowCredentials?”boolean
Whether to allow credentials
allowHeaders?
Section titled “allowHeaders?”string | Function | RegExp | string[]
Allowed request headers
allowMethods?
Section titled “allowMethods?”string[]
Allowed HTTP methods
exposeHeaders?
Section titled “exposeHeaders?”string | string[]
Headers to expose to the client
maxAge?
Section titled “maxAge?”number
Preflight cache duration in seconds
origins?
Section titled “origins?”string | Function | RegExp | string[]
Allowed origins
Returns
Section titled “Returns”Function
- Ergo middleware that returns
undefinedfor non-CORS requests,{response: {headers}}when allowed, or{response: {statusCode: 403}}when denied