Multiple CORS origins

According to the documentation at I should be able to add multiple origins to the cors definition:


and then mentioned that a response template will be used to return the correct one in the Access-Control-Allow-Origin header. However, when I do this I simply get both values returned and the browser throws a fit.

Is the response template not automatically generated? Should I add it myself to serverless.yaml? Is there an example somewhere I can have a look at?


1 Like

I worked on that issue and the following lines worked for me:

origin: “https:// www . example . com,https:// example . com,https:// dev . example . com”
- Accept
- Referer
- Session-Token
- User-Agent
allowCredentials: true

But the third origin (https:// dev . example . com) throws me a CORS error. The first two origins worked well.

(I have putted spaces between URLs because as a new user I’m not allowed to put URLs)

Hope it helps

Hi, no answers to that please ? No one know how to solve that ?

ShowBox Tutuapp Mobdro