Back

Network Hostname Whitelisting

  • 0
  • Web
andrefuchs
23 Nov, 2023, 21:56

I have a signup page that works fine on http://localhost:3000/, but returns the following error on http://192.168.2.122:3000/:

appwrite.js?v=5de0b309:445 POST https://cloud.appwrite.io/v1/account net::ERR_FAILED 403 (Forbidden)

Access to XMLHttpRequest at 'https://cloud.appwrite.io/v1/account' from origin 'http://192.168.2.122:3000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'http://localhost:3000' that is not equal to the supplied origin.

I tried whitelisting 192.168.2.122 under hostnames in AppWrite Cloud, but the issue remains.

How to fix this?

TL;DR
To fix the CORS error, you need to create a web platform in your project and set the hostname to `192.168.2.122` without any ports, protocols, or slashes. Make sure the value you pass into `setProject` in the Appwrite SDK is correct. If the project ID is empty or incorrect, the CORS error can still occur. You can find your project ID in the bottom-left corner of the settings screen. Make sure the IP address `192.168.x.xxx` is added as the hostname in the platforms section. Additionally, check if you added the web platform with or without a port. If
ideclon
23 Nov, 2023, 21:59

You need to add a Platform in Appwrite

andrefuchs
23 Nov, 2023, 22:00

Thanks for your reply. I have a Platform set up: WEB

ideclon
23 Nov, 2023, 22:12

So itโ€™s working now?

andrefuchs
24 Nov, 2023, 07:35

No

fafa
24 Nov, 2023, 08:42

Did you add the web platform with or without port?

fafa
24 Nov, 2023, 08:43

Also is the IP 192.168.x.xxx in the hostname part under platforms?

Meldiron
24 Nov, 2023, 11:23

Heyy ๐Ÿ‘‹ To get rid of CRORS error, you need to create a web platform in your project. You can set name to anything, but hostname in your case needs to be exactly 192.168.2.122 - no port, no protocols, no slashes.

If that doesnt help, please check value you pass into setProject in Appwrite SDK. If project ID is empty, or has wrong project ID value, CORS error can also be present. You can find your project ID in settings screen (button to get there is bottom left)

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