Skip to content

Header Access-Control-Allow-Methods not set #310

Description

@alfechner

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions