Connecting to MongoDB Atlas Realm from custom domain

I am using flutter web, and have deployed my app to the custom domain. While running it on local, I don’t have any issues with the connection to realm with GraphQL, but as soon as it is run on web, I get an error saying:
Access to XMLHttpRequest at ‘’ from origin ‘domain’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
I have added the domain to the Allowed Request Origins, but still I get this error. I would appreciate any help. Thanks in advance.