Skip to content

Commit

Permalink
fix(functions): handle CORS preflight requests in v1
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed May 23, 2023
1 parent 2331f25 commit f44bc09
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions functions/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,15 @@ export const onRequest: PagesFunction = async (context) => {

return response;
};

/**
* Handle CORS preflight requests.
*/
export const onRequestOptions: PagesFunction = async () => {
return new Response(null, {
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': '*',
},
});
};

0 comments on commit f44bc09

Please sign in to comment.