Back

Getting the CORS error despite adding * as hostname in platform in appwrite project

  • 1
  • Web
  • Cloud
Samrudh S
7 Apr, 2024, 09:19

I'm getting the CORS policy error despite setting the endpoint to https://cloud.appwrite.io/v1. Please help. The error states "Access to XMLHttpRequest at 'https://cloud.appwrite.io/v1/account' from origin 'http://localhost:5173/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."

Edit - I have the platform wherin the hostname is set to *. My project ID and url in the .env.local file outside the src are correct. I'm importing them into the config.ts file and then exported from the appwriteConfig function . I'm still getting the same error..As you can see, the CORS error still persists. @D5 @Dennis Ivy

TL;DR
Developers are getting CORS error despite adding * as hostname in the platform in an Appwrite project. The endpoint is set correctly to https://cloud.appwrite.io/v1, but the error "Access to XMLHttpRequest has been blocked by CORS policy" keeps appearing. The project ID and URL in the .env.local file are correct. The solution might be to ensure the Access-Control-Allow-Origin header is present on the requested resource on the 'https://cloud.appwrite.io/v1/account' endpoint.
D5
7 Apr, 2024, 09:52

Thanks for creating this! Are you sure that you have set the project ID correctly and that it's accessible from there?

Samrudh S
7 Apr, 2024, 09:56

Yup. The project ID is correct. Here is the pic of the project ID on the appwrite and I've pasted the same thing

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