Skip to content

Commit ff1c2e8

Browse files
author
Ido Shamun
committed
refactor: update cors settings
1 parent 6288b63 commit ff1c2e8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ app.keys = [config.cookies.key];
3535

3636
app.proxy = config.env === 'production';
3737

38+
const allowedOrigins = config.cors.origin.split(',');
39+
3840
app.use(cors({
3941
credentials: true,
4042
origin(ctx) {
4143
const requestOrigin = ctx.get('Origin');
42-
if (config.cors.origin.indexOf(requestOrigin) > -1) {
44+
if (allowedOrigins.filter(origin => requestOrigin.indexOf(origin) > -1).length) {
4345
return requestOrigin;
4446
}
4547
return false;

0 commit comments

Comments
 (0)