Commit 3fc52b65 authored by Sidson's avatar Sidson
Browse files

update: cors origin

parent 157a8996
......@@ -8,13 +8,7 @@ import { config, Middleware, MiddlewareInterface } from '@m-backend/core';
export default class CorsMiddleware implements MiddlewareInterface {
async use(ctx: Context, next: Next) {
return await cors({
origin: (ctx) => {
let origin = ctx.header.origin;
if (config.app.externalUrl.indexOf(origin) !== -1) {
return origin;
}
return false;
},
origin: config.app.externalUrl,
allowMethods: 'GET,HEAD,PUT,POST,DELETE'
})(ctx, next);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment