Skip to content

Commit

Permalink
Merge pull request #60 from alan16742/master
Browse files Browse the repository at this point in the history
fix: preflight request
  • Loading branch information
vcheckzen authored Oct 12, 2024
2 parents eef916b + 163e471 commit 8ca50c0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions back-end-cf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ async function handleRequest(request) {
return Response.redirect(url, 302);
}

// preflight
if(request.method === 'OPTIONS') {
return new Response(null, {
status: 204,
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Max-Age': '86400',
}
});
}

const returnHeaders = {
'Access-Control-Allow-Origin': '*',
'Cache-Control': 'max-age=3600',
Expand Down

0 comments on commit 8ca50c0

Please sign in to comment.