Back

CORS Error on Selfhosted Appwrite Instance

  • 1
  • Self Hosted
  • Web
ampir3
25 Mar, 2024, 19:28

So I am hosting an appwrite instance via docker myself, I have added the website as a platform in the dashboard and also added the respective hostname to be enabled (localhost). Nevertheless it still gives me the following error, when trying to call Appwrite via my web app:

Access to XMLHttpRequest at 'http://127.0.0.1/v1/account' from origin 'http://localhost:5173' has been blocked by CORS policy: Request header field x-sdk-name is not allowed by Access-Control-Allow-Headers in preflight response.

TL;DR
Developers hosting their own Appwrite instance are encountering a CORS error when trying to access it from a SvelteKit web app. The error indicates that the x-sdk-name header is not allowed by the CORS policy. To resolve this, developers need to ensure that the x-sdk-name header is allowed in the Access-Control-Allow-Headers response.
ampir3
25 Mar, 2024, 19:29

The web app is written in SvelteKit and I am using the web SDK by appwrite in order to access my appwrite instance.

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