Flutter Developer
Hi team,
I'm facing an issue after deploying my React app to production.
Issue:
When trying to upload a file to Appwrite storage from the production domain https://pro26.in, I'm getting the following CORS error:
Access to fetch at 'https://appwrite.pro26.in/v1/storage/buckets/form_uploads/files'
from origin 'https://pro26.in' has been blocked by CORS policy:
The 'Access-Control-Allow-Origin' header has a value 'https://localhost'
that is not equal to the supplied origin.
Browser Console Log:
POST https://appwrite.pro26.in/v1/storage/buckets/form_uploads/files net::ERR_FAILED 403 (Forbidden)
Error uploading photo: TypeError: Failed to fetch
Error submitting form: Error: Failed to upload photo. Please try again.
What I’ve done so far:
- In Appwrite Cloud, I added
https://pro26.into the project's platforms section (under Web). - Everything works perfectly on localhost, but fails after deployment.
Questions:
- Do I need to configure CORS anywhere else besides the platform settings?
- Is it possible that Appwrite is still treating requests as coming from
localhost? - How can I fix the Access-Control-Allow-Origin mismatch issue for my production domain?
Any guidance would be appreciated. Thanks in advance!