corydolphin / flask-cors

Cross Origin Resource Sharing ( CORS ) support for Flask
https://flask-cors.corydolphin.com/
MIT License
873 stars 140 forks source link

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

Open ghost opened 4 years ago

ghost commented 4 years ago

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?

miqayel-manvelyan commented 3 years ago

@davidmoseler

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

cors.init_app(app)
n1ngu commented 5 months ago

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.