cors = CORS(app, resources={'/foo': {'origins': 'http://localhost:port'}})

@app.route('/foo', methods=['POST'])
@cross_origin(origin='localhost', headers=['Content- Type', 'Authorization'])
def foo():
    return request.json['inputVar']
if __name__ == '__main__':
    app.run()
Solve Cross Origin Resource Sharing with Flask