Flutter web, deployed on prod server, when trying to create an anonymous session the header for some reason is https://localhost, that gets blocked by cors, even though I have changed the appwrite API endpoint to the prod server in the constants file in my project ??? Not sure what I am missing,
Have you added the prod server url as web/flutter web platform in the project overview page?
I did, added a wildcard domain *.myapp.com
One last check
Did you also updated the project id?
You'll get CORS when project is is mismatched
What exactly are the full browser console logs and what are the request headers for the failed request?
Sorry for the late response. The console log is "CORS Allow Origin Not Matching Origin". Looking at the request header the Request Headers Origin is my apps URL but Response headers has " access-control-allows-origin: https://localhost"
So the request header origin mismatches the response header allow origin. Now the question is why is the response header origin localhost. Found nothing is .env file. Looked at the platform and that's also also added flutter web *.myapp.com ..
I hope in don't need to add both. Just have flutter web added. Also dont have any custom domains configured but did the domain SSL via .env file .. Could no custom domain be causing appwrite server to respond with origin localhost ?
Fixed the issue. Just add multiple web platforms like "*.example.com" , "example.com" "www.example.com" .. Should work
[Closed] Flutter Web : CORS Header has a value 'https://localhost'
[SOLVED] Flutter Web : CORS Header has a value 'https://localhost'
<a:agooglethumbsup:635256484682530825>
Recommended threads
- listRows result parsing issue
I'm using Appwrite Dart SDK "24.2.0". When I perform a listRows call in dart, I have this reponse in JSON: in " Future<models.RowList> listRows()" { "total" :...
- Broken Flutter SDK >=24.1.0
Row.fromMap now does: ``` data: Map<String, dynamic>.from(map["data"] ?? {}) ``` But Appwrite Cloud TablesDB row responses return custom row columns flattene...
- Flutter OAuth2 does not attach Google se...
Hi Appwrite team, I’m using Appwrite Auth in a Flutter mobile app and trying to upgrade an anonymous user to Google OAuth. Docs say that if there is already a...