Back

[SOLVED] CORS Error In React JS

  • 0
  • Web
bdhamithkumara
21 Mar, 2023, 06:22

I am using appwrite for the first time. I tried the example in the documentation. However, I got the following error.I am using appwrite for the first time. I tried the example in the documentation. However, I got the following error. here is the error,

Access to XMLHttpRequest at 'http://hl-appwriter.buildapi.cyou/v1/account' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

anyone have idea how to fix this ? Thank you !!!

TL;DR
The user had a CORS error in React JS while using appwrite for the first time. The error stated that the preflight request didn't pass the access control check due to a redirect not being allowed. The user was able to solve the issue by changing the URL from http to https and making sure their client app was added as a web platform to their project.
Drake
21 Mar, 2023, 06:25

Did you add your client app as a web platform to your project?

bdhamithkumara
21 Mar, 2023, 06:34

yes

Drake
21 Mar, 2023, 06:35

Also, make sure you're using https for your endpoint

bdhamithkumara
21 Mar, 2023, 06:41

I originally used http, but after your response I changed it to https. I got a solution to my problem. Thank you for your support

Drake
21 Mar, 2023, 13:34

[SOLVED] CORS Error In React JS

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