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
- Google Auth not working in a React App
Authentication with Google has failed. It redirects back to the signin route in React. Attached screenshots for configuration of Google console and Appwrite Go...
- How to display images from storage
I tried the link above, but it returns the error “`Please upgrade to a higher plan.`” I don’t need Transformations at the moment, I just want to display the ima...
- Cant sign up for appwrite cloud. Never s...
Cant sign up for appwrite cloud. Never sends me an email verification