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: truetype: boolean- Whether to enable the
corsservice, you can set it tofalseto stop thecorsservice.
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,DELETEandPATCHare allowed in the string.
For more detailed settings and instructions, you can refer to here.