CORS headers for HTTP endpoints
One last question for you guys: how do I set access control headers for my HTTP endpoints?
2 Replies
The
Response
object constructed in an HTTP endpoint can have headers passed to it, you need to add these; something like
I found https://stackoverflow.com/questions/66486610/how-to-set-cors-in-cloudflare-workers somewhat helpful (also stay tuned for a blog post or further docs on this at some point)
Stack Overflow
How to set CORS in Cloudflare Workers?
I'm a newbie in Cloudflare Workers.
How to set CORS in Cloudflare Workers?
response = await cache.match(cacheKey);
if (!response) {
// handle fetch data and cache
}
const myHeaders = new