Back

CORS Error when trying to fetch from server

  • 0
  • Self Hosted
  • Databases
  • Web
xmaniaxz
1 Feb, 2025, 10:14
TypeScript

config: Object { endpoint: "https://appwrite.lostcausenetwork.com/v1", selfSigned: false, project: "6779379f003356ea721e", … }
​​
endpoint: "https://appwrite.lostcausenetwork.com/v1"
​​
forwardeduseragent: ""
​​
jwt: ""
​​
key: "Correct key"
​​
locale: ""
​​
project: "6779379f003356ea721e"
​​
selfSigned: false
​​
session: ""
​​
<prototype>: Object { … }

headers: Object { "x-sdk-name": "Node.js", "x-sdk-platform": "server", "x-sdk-language": "nodejs", … }
​​
"X-Appwrite-Key": "Correct Key"
​​
"X-Appwrite-Project": "6779379f003356ea721e"
​​
"X-Appwrite-Response-Format": "1.6.0"
​​
"user-agent": "AppwriteNodeJSSDK/14.1.0 Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0"
​​
"x-sdk-language": "nodejs"
​​
"x-sdk-name": "Node.js"
​​
"x-sdk-platform": "server"
​​
"x-sdk-version": "14.1.0"
​​
<prototype>: Object { … }

<prototype>: Object { … }```

`ERROR: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://appwrite.lostcausenetwork.com/v1/databases/677fa96000311c0521fc/collections/677fa969000d44d60c57/documents. (Reason: header ‘user-agent’ is not allowed according to header ‘Access-Control-Allow-Headers’ from CORS preflight response).`
TL;DR
Developers are encountering a CORS error due to the 'user-agent' header not being allowed in the CORS preflight response. Check CORS configuration on the server and ensure it allows the necessary headers, or adjust the request headers to comply with the CORS policy.
xmaniaxz
1 Feb, 2025, 10:15

I have set a wildcard as platform (for development.)

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