title: CORS issues for Flask API call from React both in localhost
body: <p>I am calling a Flask API from React (both running on localhost) and I am running into CORS problems.
  When the request is made, the browser (Chrome) gives the following error</p>
  <pre><code>Access to XMLHttpRequest at 'http://localhost:5000/sas' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
  </code></pre>
  <h1>Setup</h1>
  <p>The Flask setup is the following</p>
  <pre><code>from flask_cors import CORS
  from flask import Flask, request, Response
  from flask_restful import Api, Resource
  import json
  
  class SAS(Resource):
      def get(self):
          content = request.json
          js = json.dumps(
              {
                  &quot;Response&quot;: &quot;Some response&quot;
              }
          )
          resp = Response(js, status=200, mimetype='application/json')
          return resp
  
  app = Flask(__name__)
  cors = CORS(app)
  api = Api(app)
  api.add_resource(SAS, '/sas/')
  </code></pre>
  <p>The call using axios in React is the following</p>
  <pre><code>  buttonPressed = async event =&gt; {
      event.preventDefault();
      const response = await axios.get(`http://localhost:5000/sas`, {
        data: {
          user: &quot;user&quot;,
          file_name: &quot;user&quot;,
          directory_name: &quot;user&quot;
        }
      });
    };
  </code></pre>
  <p>NOTE: Running the request from Postman works and shows the header <code>Access-Control-Allow-Origin = *</code></p>
  <p>Any idea on how to solve the problem?</p>
  <p>Also, if I was to run the React frontend and API as a dockerized application, I should not see this problem anymore correct? In this case I would also consider circumnavigating the problem while I am developing</p>