Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
I think DigitalOcean Functions handle OPTIONS requests with a built-in static CORS response, meaning the platform itself replies without invoking your function. That’s probably why you can’t customize headers like Access-Control-Allow-Origin or Access-Control-Allow-Credentials directly inside the function.
If you need custom CORS behavior, you can deploy your functions as part of an App Platform app and configure the CORS policy there:
https://docs.digitalocean.com/products/app-platform/how-to/configure-cors-policies/
Another option would be to place a lightweight proxy in front, such as an NGINX reverse proxy or a Cloudflare Worker, to forward the request and inject the custom CORS headers before returning the response. Not 100% sure if more granular control will come to Functions directly, but this is the best workaround for now.