A Flask extension for handling Cross Origin Resource Sharing (CORS), making cross-origin AJAX possible.
Questions tagged [flask-cors]
82 questions
19
votes
3 answers
Flask-CORS not working for POST, but working for GET
I'm running a Flask-Restful API locally and sending a POST request containing JSON from a different port. I'm getting the error
No 'Access-Control-Allow-Origin' header is present on the requested resource.
However, when I run
curl --include -X…
![](../../users/profiles/6642165.webp)
hatooku
- 273
- 1
- 2
- 11
8
votes
8 answers
Python flask-cors ImportError: No module named 'flask-cors' Raspberry pi
I'm following the flask-cors tutorial from the documentation here:
https://pypi.python.org/pypi/Flask-Cors
but when i installed it on my raspberry pi and run my python app i'm getting this error
Traceback (most recent call last):
File "app.py",…
![](../../users/profiles/4664894.webp)
Nelson Candia
- 179
- 1
- 2
- 14
8
votes
2 answers
zappa custom authorizer for flask with cors
I am using flask-cors for a aws python aws lambda API. I deployed it with zappa, it worked as intended. Yet cors does not work with custom authorizer
inspired by…
![](../../users/profiles/5874981.webp)
Serge
- 2,794
- 2
- 11
- 27
8
votes
1 answer
Getting CORS headers in a Flask 500 error
I've got a Flask app set up like this
from flask import Flask
from flask.ext.cors import CORS
app = Flask( . . . )
app.debug = True
CORS(app, allow_headers='Content-Type')
CORS works correctly for routes that complete properly. However, if an…
![](../../users/profiles/95195.webp)
Justin Dearing
- 12,753
- 19
- 80
- 146
7
votes
3 answers
Why is Flask-Cors not detecting my Cross-Origin domain in production?
My website has a separate server for the front-end and back-end, and so my back-end server needs to open up CORS permissions so that the front-end can request data from it.
I am using Flask-Cors successfully in development, but it doesn't work when…
![](../../users/profiles/2203144.webp)
mareoraft
- 2,402
- 2
- 19
- 50
4
votes
3 answers
enabling CORS Google Cloud Function (Python)
Can use you flask_cors in Google Cloud Functions?
app = Flask(__name__)
cors = CORS(app)
Locally this flask_cors package works but when deployed onto Cloud Functions it does not.
I have tried many different ways, as GCP has suggested…
![](../../users/profiles/11837656.webp)
mdev
- 49
- 5
4
votes
0 answers
Flask logs duplicate XHR CORS requests from Safari
Firstly, I'm not sure if this is a Flask or a Safari or a Flask-CORS issue.
In order to emulate a production setting, I have a local Flask backend (API) on one domain and a front-end (SPA) on a different domain. I initially tried this with both the…
![](../../users/profiles/7833514.webp)
Karl Sutt
- 323
- 1
- 7
4
votes
1 answer
Python Flask CORS - API always allows any origin
I've looked through many SO answers, and can't seem to find this issue. I have a feeling that I'm just missing something obvious.
I have a basic Flask api, and I've implemented both the flask_cors extension and the custom Flask decorator…
![](../../users/profiles/3449806.webp)
sean
- 3,094
- 5
- 23
- 41
4
votes
1 answer
Permitting CORS in Flask
I've a flask endpoint where I've permitted CORS in the following manner.
app = Flask(__name__)
CORS(app, resources={r"/api/*": {"origins": "*"}})
app.register_blueprint(store, url_prefix='/api/')
I still run into the following issue.
Response to…
![](../../users/profiles/7551257.webp)
Melissa Stewart
- 2,671
- 8
- 29
- 72
4
votes
2 answers
Getting CORS error in angularJS front end
I am using a flask server with an angular front end. Up until recently, I was running the project on my local and had no issues.
I now moved my project to a remote server and have been getting the following error. I am not sure what i'm doing…
![](../../users/profiles/2629034.webp)
galeej
- 483
- 7
- 21
3
votes
1 answer
CORS request did not succeed in python flask-socketio
I need help in debugging -the Same Origin Policy disallows reading the remote resource at https://some-domain.com. (Reason: CORS request did not succeed) in python flask-socketio error.
I am working on a chat application using python flask-socketio.…
![](../../users/profiles/6508520.webp)
VinothRaja
- 1,324
- 7
- 18
3
votes
1 answer
Flask Cors isn't working
I'm trying to enable CORS in my Flask app, but it seems I can always access my urls from the browser whatever I put in the origins.
I don't know what I do wrong. Here's my code
from flask import Flask, jsonify
from flask_cors import CORS
app =…
![](../../users/profiles/4269376.webp)
Khaled Karam
- 173
- 3
- 13
2
votes
0 answers
Configure specific headers for Preflight requests in Flask
I am working on a react Native front and a Python Flask backend. For my POST requests, I sometimes need to provide two additional headers: X-CSRF-TOKEN-ACCESS and X-CSRF-TOKEN-REFRESH for my authentication.
However, my problem is I'm using…
![](../../users/profiles/10800954.webp)
Abilys38
- 303
- 4
- 16
2
votes
1 answer
Response Header in python rest api and flask , flask cors
I have made an rest api on python with flask(port:5000), and i am making a get and a post request from a web site (port:80).
I am getting the cors error, so i tried to create a response header in my rest api for the site.
But i am getting the import…
![](../../users/profiles/13338417.webp)
Aristogiannis
- 31
- 4
2
votes
1 answer
How to whitelist domain using Flask CORS
I am having some trouble getting Flask CORS to whitelist certain domains from being able to do a POST request. I am making a curl request from www.google.com but making the domain googl.com to confirm the post.
Currently every single post is allowed…
![](../../users/profiles/10137324.webp)
learncodes123
- 265
- 1
- 11