Getting CORS preflight error even with flask cors initialized
See original GitHub issueHey guys, I’ve been trying to get flask_cors to work for over two weeks now, so thought that I would write an issue.
Here’s what is in the init.py file
app = Flask(__name__, static_url_path='/static')
app.config.from_pyfile('config.py')
cors = CORS(resources={
r'/*': {
'origins': [
'http://localhost:8080'
]
}
})
cors.init_app(app)
The error that I’m getting is:
login?redirectNotebook=rose.intro:1 Access to XMLHttpRequest at 'http://localhost:5000/users' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
Went into the library to poke around and it looks like the after request isn’t being called. The backend is running on localhost:5000 and the frontend is running on localhost:8080, any help would be greatly appreciated!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:20
Top Results From Across the Web
Python/Flask Rest API not passing preflight w/CORS
I am trying to get the simplest rest api ...
Read more >Flask-CORS — Flask-Cors 3.0.10 documentation
A Flask extension for handling Cross Origin Resource Sharing (CORS), making cross-origin AJAX possible. This package has a simple philosophy: when you want...
Read more >Flask-Cors Documentation - Read the Docs
In the simplest case, initialize the Flask-Cors extension with default arguments in order to allow CORS for all domains on all routes.
Read more >Fix Flask CORS Error: Access-Control-Allow-Origin - YouTube
FULL STACK COURSE (React, Flask, & PostgreSQL): https://lukepeters.me/build-a-full-stack-web-app-with-react- flask -and-postgresqlCORS stands ...
Read more >flask has been blocked by cors policy: no 'access-control ...
Old Answer · from flask import Flask from flask_cors import CORS app = Flask(__name__) CORS(app) · Access to XMLHttpRequest at 'http://host:5006/api/v1.0/group/? ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Elynad what I did is
I gave up a long time ago and used a different lib, appreciate it though.