frigjord
frigjord3y ago

How to setup CORS with serve? I get 403 forbidden.

I've setup the following headers (OPTIONS response):
new Response(null, {
status: 204,
headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', 'Access-Control-Allow-Headers': '*' }
})
new Response(null, {
status: 204,
headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', 'Access-Control-Allow-Headers': '*' }
})
I'm getting 403 when the request has Access-Control-Request-Method: OPTIONS. Which is what the browser send. Without that, it replies with 204 as expected.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?