CORS
We use @koa/cors
to solve CORS, although it has reasonable default settings, but you can still use project config (default is vulcan.yaml
) to change some settings to suit your own needs.
like so:
cors:
enabled: true
options:
origin: 'http://google.com'
allowMethods: 'GET,HEAD,PUT'
settings
enabled
default: true
type: boolean
- Whether to enable the
cors
service, you can set it tofalse
to stop thecors
service.
options
We support all options of @koa/cors
, You can see all the options available to @koa/cors
here.
origin
default: {request Origin header}
type: string | Function(ctx)
- originAccess-Control-Allow-Origin
, default is request Origin header
allowMethods
default: 'GET,HEAD,PUT,POST,DELETE,PATCH'
type: string
- onlyGET
,HEAD
,PUT
,POST
,DELETE
andPATCH
are allowed in the string.
For more detailed settings and instructions, you can refer to here.