I used the simple usage example from the docs:
from flask import Flask
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
@app.route("/")
def helloWorld():
return "Hello, cross-origin-world!"
app.run()
I used curl -X "OPTIONS" -I http://127.0.0.1:5000/ to check the headers and received the following output:
HTTP/1.1 200 OK
Server: Werkzeug/2.1.0 Python/3.9.2
Date: Thu, 31 Mar 2022 10:32:07 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 26
Access-Control-Allow-Origin: *
For my understanding the Access-Control-Allow-Methods header is missing.
I changed CORS(app) to CORS(app, methods=["GET"]). Still the same result.
My requirements.txt looks like this:
Flask==2.1.1
flask-cors==3.0.10
This causes the OPTIONS preflight check in our apps to fail. Are we doing something wrong or is this an issue?
I used the simple usage example from the docs:
I used
curl -X "OPTIONS" -I http://127.0.0.1:5000/to check the headers and received the following output:For my understanding the
Access-Control-Allow-Methodsheader is missing.I changed
CORS(app)toCORS(app, methods=["GET"]). Still the same result.My
requirements.txtlooks like this:This causes the
OPTIONSpreflight check in our apps to fail. Are we doing something wrong or is this an issue?