Merge pull request #9178 from supabase/laktek-patch-2

This commit is contained in:
Inian authored and GitHub committed 2022-09-27 09:14:52 +08:00
commit 8e6c30d1d0
1 file changed
+6
+6
View File
@@ -290,12 +290,18 @@ We recommend using hyphens to name functions because hyphens are the most URL-fr
We recommend adding a check to handle [CORS Preflight](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request) requests in your edge function to be able to invoke the function from browsers.
```ts
export const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey',
}
serve(async (req) => {
if (req.method === 'OPTIONS') {
return new Response('ok', { headers: corsHeaders })
}
...
})
```
## Limitations