Jump to content

Recommended Posts

Posted

I've uploaded flutter app to server.

App works fine except for getting data using web API's

on googling I came to the conclusion that I need to activate CORS on web server.

Please let me know how can I activate CORS on server.

username : ansaraf

Posted

Hey @gsakola could you please provide more information on what the issue you're getting is, and why you think you need CORS. I ask this as CORS is more of a code design or HTTP request pattern than a configuration toggle. Would be useful for some context to help you futher.

Posted
13 hours ago, Bailey said:

Hey @gsakola could you please provide more information on what the issue you're getting is, and why you think you need CORS. I ask this as CORS is more of a code design or HTTP request pattern than a configuration toggle. Would be useful for some context to help you futher.

first of all I'm new with web development. though I've written some API's in php but they are basically for my desktop app only. 

When I'm running my Flutter App from Desktop mode it works fine, but in Web Mode it throws error XMLHttpRequest error.

On searching I came to know that it has something to do with CORS

  • 4 weeks later...
Posted

Sorry for the delayed response, it appears you need to handle CORS yourself code-side. This medium article appears to explain how to fix this with relation to Flutter: https://medium.com/@mustafatahirhussein/xmlhttprequest-blocked-by-cors-policy-flutter-web-fix-6bebe09d059f

Though I haven't vetted it myself. 

I also recommend reading what CORS itself is, so you have a better understanding of what it's trying to do: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...