CORS (Cross-Origin Resource Sharing) support for Invoking from the browser
To invoke edge functions from the browser, you need to handle CORS Preflight requests.
See the example on GitHub.
Recommended setup#
We recommend adding a cors.ts
file within a _shared
folder which makes it easy to reuse the CORS headers across functions:
You can then import and use the CORS headers within your functions: