I’m trying to add multiple domains to the list of Access-Control-Allow-Origin in netlify.toml file. i don’t want to add Access-Control-Allow-Origin = “*” since there is a security issue. i would like to allow only a list of domains to enable cors.
[[headers]]
for = “/page-data/*.json”
[headers.values]
Access-Control-Allow-Origin = “https://domain1.com”
Content-Type = “application/json”
[[headers]]
for = “/page-data/*.json”
[headers.values]
Access-Control-Allow-Origin = “https://domain2.com”
Content-Type = “application/json”
when i do the above, only last domain (i’e https://domain2.com) is working and the first one doesn’t.
is there any way i can achieve this in netlify.toml or _header file?