Back

CORS issue on browser for Auth module

  • 0
  • Auth
  • Web
  • REST API
ZER0
20 Jan, 2025, 16:35

Hi guys, I'm dealing with a CORS issue but configurations seems alright, please help:

TypeScript
Access to fetch at 'https://api.mega-voice-command.com/v1/account' from origin 'https://mega-voice-command.com' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://localhost' that is not equal to the supplied origin. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled

So my endpoint is https://api.mega-voice-command.com/v1 and trying to access from https://mega-voice-command.com and I have the domain whitelisted in hostnames with wildcard subdomain (attached screenshot). Just for the record the code works from localhost as the CORS is literally allowing localhost from backend. and when using in server-side authentication, appwrite functions, etc, it's working. DNS records and SSL is set properly as you can see if you access the endpoint. but from browser we are experiencing CORS error.

any idea how do I fix this?

TL;DR
Developers are facing a CORS issue where the 'Access-Control-Allow-Origin' header value is incorrect. The server needs to send the header with the correct value or adjust the request mode to 'no-cors'. This issue occurs when accessing 'https://api.mega-voice-command.com/v1/account' from 'https://mega-voice-command.com'. Whitelisting is already in place, but the problem persists. To solve this, the 'Access-Control-Allow-Origin' header should be fixed to match the requested origin.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more