cors icon indicating copy to clipboard operation
cors copied to clipboard

How to set multiple domains ?

Open vdegenne opened this issue 4 years ago • 2 comments

I tried

app.use(cors({
  origin: function (ctx) {
    if (['https://www.example1.com', 'https://www.example2.com'].includes(ctx.get('Origin'))) {
      return ctx.get('Origin');
    }
    return null;
  }
}));

But it doesn't work, any solution ?

vdegenne avatar Dec 16 '20 14:12 vdegenne

See https://github.com/koajs/cors/issues/52#issuecomment-413887382

yeefun avatar Mar 12 '21 08:03 yeefun

@vdegenne weird, my solution is the same as the comment you refer to but It couldn't work in my situation.

vdegenne avatar Mar 12 '21 10:03 vdegenne