Flask Cors Policy No Access Control Allow Origin

[Solved] Flask Cors Policy No Access Control Allow Origin | Whatever - Code Explorer | yomemimo.com
Question : flask cors policy no 'access-control-allow-origin'

Answered by : manikant-kumar

# initialization
app = Flask(__name__)
app.config['SECRET_KEY'] = 'the quick brown fox jumps over the lazy dog'
app.config['CORS_HEADERS'] = 'Content-Type'
cors = CORS(app, resources={r"/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()

Source : https://stackoverflow.com/questions/26980713/solve-cross-origin-resource-sharing-with-flask | Last Update : Sun, 13 Jun 21

Answers related to flask cors policy no access control allow origin

Code Explorer Popular Question For Whatever