title: Flutter: No 'Access-Control-Allow-Origin' header is present on the requested resource
body: <p>I have created REST GET API using python Flask and it's code is below</p>
  <pre><code>app = Flask(__name__)
   
  @app.route(&quot;/youtube&quot;)
  def firstGetAPI():
   
      try:
          url = request.args.get('url')
          print(f'URL is {url}')
          res = &quot;Success&quot;
          response = flask.Response(res)
          response.headers.set('Access-Control-Allow-Origin', '*')
          response.headers.set('Access-Control-Allow-Headers', 'Content-Type,Authorization')
          response.headers.set('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS')
          return response, 200
      except Exception as e:
          response = {&quot;status&quot;:&quot;Fail&quot;, &quot;message&quot;:str(e)}
          return json.dumps(response)
   
  if __name__ == &quot;__main__&quot;:
      app.run(host='0.0.0.0', debug=True, port=8080)
  </code></pre>
  <p>Now on Frontend side the Flutter code is below</p>
  <pre><code>child: ElevatedButton(
                  child: const Text('Download'),
                  onPressed: () async {
                    var header = {
                      'Access-Control-Allow-Origin': '*',
                      &quot;Accept&quot;: &quot;application/json&quot;
                    };
  
                    var url = Uri.parse(
                        'http://192.168.2.237:8080/youtube?url=www.google.com');
  
                    print('URL is : ${url}');
                    var response = await http.get(url, headers: header);
                    print('Response status: ${response.statusCode}');
                    print('Response body: ${response.body}');
                  },
                ),
  </code></pre>
  <p>I have run this on Chrome Browser but I am always getting an error like below</p>
  <pre><code>     URL is : http://192.168.2.237:8080/youtube?url=www.google.com
  :49831/#/:1 Access to XMLHttpRequest at 'http://192.168.2.237:8080/youtube?url=www.google.com'
   from origin 'http://localhost:49831' has been blocked by CORS policy: Response to preflight 
   request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  browser_client.dart:74 GET http://192.168.2.237:8080/youtube?url=www.google.com net::ERR_FAILED
  </code></pre>
  <p>Sorry as I have no idea if this is problem with Python or Flutter, I have combined both code over here, Thanks</p>