Hi, I couldn't find a way to solve cors for the function with the custom domain I've added. For Project level custom domain it is handled by the hostname and platform combination.
Please share me the solution / workaround if any.
TL;DR
To enable CORS for a function with a custom domain, developers need to manually add the CORS headers to their response. An example of allowing all origins is:
```js
return res.json(response, 200, {'Access-Control-Allow-Origin': '*'});
```
For project-level custom domains, CORS is handled by the combination of the hostname and platform. Developers must add the necessary CORS headers to their function's response for CORS to work properly.You'll need to add the CORS yourself
For example allow all
TypeScript
return res.json(response,200,{'Access-Control-Allow-Origin': '*',})
Recommended threads
- Charged after Downgrade
I downgraded from the pro plan last month, but it’s still trying to charge my card this month and my account has been restricted
- Sydney Cloud Sites: App Git deployment a...
Project ID: rentwize-db The app Site fails after the build completes with a missing build archive error. Site id: app Framework: TanStack Start SSR Output dir...
- Active Running Project Deletion Alert Em...
Hi , I received an email alert from Appwrite today stating “your project will be deleted within 14 days if no action is taken,” though I have been actively usin...