frigjordF
Denoβ€’4y ago
frigjord

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': '*' }
})

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.
Was this page helpful?