Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preflight requests must return OK #297

Open
CrafterSvK opened this issue Jul 15, 2021 · 1 comment
Open

Preflight requests must return OK #297

CrafterSvK opened this issue Jul 15, 2021 · 1 comment

Comments

@CrafterSvK
Copy link

Hello, I found out that every OPTIONS request from origin must provide response with response code 200. Without the response code, it will get ignored and preflight request fails. Should we implement this or make it more visible? (Solution is to create before_app_request and checking the OPTIONS method in your flask application). But if preflight should fail due to Access-Control-Allow-Origin not being the same as origin needs, what should we return?

@tobiaslocker
Copy link

I found this behavior also irritating, forces me to add the following logic when I e.g. want to return 201 for a POST request

    if request.method == 'OPTIONS':
        return make_response('OK', 200)

This seems redundant and I guess it could be handled in flask-cors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants