Skip to content

CORS Requests + Responses #2040

Closed Answered by kettanaito
gxxcastillo asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, @gxxcastillo.

What you are doing looks correct to me. You can use http.options() handler to add the CORS response to all requests or a subset of requests.

http.options('*', () => {
  return new Response(null, {
    status: 200,
    headers: {
      'Access-Control-Allow-Origin': '*',
      'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE',
      'Access-Control-Allow-Headers': '*',
    },
  })
})

However, I'm still getting Network Errors.

Can you please share those errors? Where are they coming from? What do they state?

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by gxxcastillo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants