Jump to content

How to Activate CORS


gsakola

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...