koa-cors icon indicating copy to clipboard operation
koa-cors copied to clipboard

Is it possible to declare multiple origins to allow?

Open PanicIsReal opened this issue 8 years ago • 1 comments

The option says origin expects a string, is it possible to allow an array of strings so you can allow more than one domain?

PanicIsReal avatar May 29 '16 05:05 PanicIsReal

I might be mistaken, but from what I gathered from the spec is that multiple domains are not supported ( https://www.w3.org/TR/cors/#access-control-allow-credentials-response-header ). To use multiple origins with this middleware, use the feature to pass a function in options.origin that compares the origin of the request (this.get('origin') in Koa 1) with your array and echos back the request origin if it is on your list.

ahauser31 avatar Sep 14 '16 07:09 ahauser31