I’m trying to re-use a function I already deployed in a new app. When testing on localhost
I encounter CORS issues (as one would ), so I tried adding redirects
and headers
to the netlify.toml
of the original app:
[build]
functions = "./functions"
command = "yarn run build"
publish = "public"
[[redirects]]
from = "/feedback"
to = "/.netlify/functions/feedback"
status = 200
[[headers]]
# Define which paths this specific [[headers]] block will cover.
for = "/feedback"
[headers.values]
Access-Control-Allow-Origin = "*"
However, I can verify that while the app still works, the Access-Control-Allow-Origin
is not returned (tried calling it with Postman: results came back, header didn’t). I tried adding several other headers to test, even tried for = "/*"
- to no avail.
What am I missing? How can I return the proper CORS header for my function?
Thanks!