flask-cors icon indicating copy to clipboard operation
flask-cors copied to clipboard

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ((url)). (Reason: CORS preflight response did not succeed)

Open ghost opened this issue 5 years ago • 2 comments

After installing and applying flask CORS to the application (cors = CORS(app)), axios requests to the application still return with

"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ((url)). (Reason: CORS preflight response did not succeed)"

after an initial OPTIONS request. There is no mention about "preflight" in the documentation and no solution to this problem can be found at any site as far as I'm aware (for example, a search for "Reason: CORS preflight response did not succeed" flask at google returns only 3 results, none of which even mention the word "preflight" or "flask".

Please, can you share a minimal configuration example such that flask just allows CORS for every url already and that's it?

ghost avatar Jul 17 '20 04:07 ghost

@davidmoseler

cors = CORS(resources={
    r'/*': {
        'origins': [
            'http://localhost:3000'
        ]
    }
})

cors.init_app(app)

miqayel-manvelyan avatar Jul 29 '20 18:07 miqayel-manvelyan

According to the docs, this use-case is the simplest setup https://flask-cors.readthedocs.io/en/latest/#simple-usage

So, I am unsure I understand this issue.

n1ngu avatar Feb 04 '24 10:02 n1ngu