A Flask extension for handling Cross Origin Resource Sharing (CORS), making cross-origin AJAX possible.
Questions tagged [flask-cors]
82 questions
1
vote
0 answers
Cross-Origin Request Blocked with Flask when using BasicAuth
I have a Flask application containing various images displaying some clusters constructed by a K-Means algorithm.
The user should be able to select one or several images and afterwards get redirected to a web-page where the clusters can be further…
![](../../users/profiles/8819603.webp)
Nicolai Iversen
- 279
- 2
- 14
1
vote
0 answers
Using Flask-CORS with Flask LoginManager
My flask back-end authentication is using Flask LoginManager to handle users login and logout.
The LoginManager is session based auth and i'm having a lot of troubles in JavaScript front-end with the views which are using @login_required…
![](../../users/profiles/10576039.webp)
Ramtin Mousavi
- 257
- 3
- 16
1
vote
1 answer
Flask CORS triggers error after request
I have an API built with Flask and Flask-Restplus. My file api.py contains the following:
from flask import Flask, request, Blueprint, abort, jsonify, url_for
from flask_cors import CORS
from flask_restplus import Resource, Api, fields
[...]
app =…
![](../../users/profiles/6283849.webp)
Alexis.Rolland
- 4,378
- 3
- 32
- 59
1
vote
1 answer
Flask app hosted by CherryPy: OPTIONS returns 404
I have a restful API created using Flask and Flask-Restful. Everything works fine using the development server. All routes are in a Blueprint, though the particular route we're dealing with here is not a Flask-Restful one. It's just a normal Flask…
![](../../users/profiles/1892468.webp)
markand
- 2,167
- 1
- 12
- 14
1
vote
1 answer
Uploading File from Vue to Flask CORS Doesn't Work
I am trying to upload a file from vue to flask, but I get
Cross-Origin Request Blocked: The Same Origin Policy disallows
reading the remote resource at http://localhost:5000/upload.
(Reason: CORS header ‘Access-Control-Allow-Origin’…
![](../../users/profiles/6365501.webp)
LinearLeopard
- 562
- 1
- 4
- 17
1
vote
2 answers
flask redirect "XMLHttpRequest cannot load..." error localhost
Running flask locally, trying to call:
@app.route('/foo_route', methods=['POST'])
@cross_origin(origin='*')
def foo():
return redirect("https://www.google.com/")
And I get the following error:
XMLHttpRequest cannot load…
![](../../users/profiles/4005394.webp)
shell
- 1,647
- 2
- 17
- 31
1
vote
1 answer
"No 'Access-Control-Allow-Origin' header" error in Flask POST request [CORS]
I'm getting the following CORS error making a POST request to a flask server from an angular app:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Flask server:
from flask import Flask, request
from flask.ext.cors import…
![](../../users/profiles/2521744.webp)
Andrew Heekin
- 611
- 1
- 6
- 14
1
vote
1 answer
Basic Auth Header appears to be lost
I am writing a Flask RESTful server and an AngularJS client, and am running into an issue where it appears the username and password information are being lost in transmission, so to speak.
In the Javascript console, I can tell that the client is…
![](../../users/profiles/1456948.webp)
Brent Hronik
- 2,207
- 21
- 42
1
vote
1 answer
Issue with basic auth
EDITED for clarity:
Using python/Flask REST-API to provide secure endpoints (using basic auth) for an ExtJS app. CORS is enabled. All had been working splendidly in all my testing with Safari. Decided to test other browsers (IE, Chrome and Firefox)…
![](../../users/profiles/1968829.webp)
horcle_buzz
- 1,741
- 1
- 20
- 45
0
votes
1 answer
Python Flask CORS - No 'Access-Control-Allow-Origin' header is present on the requested resource
I have a simple Ajax script written on a Shopify Product Page. This script would be triggered and send a json message to the API server whenever the upload button is clicked
jQuery.ajax({
url:…
![](../../users/profiles/8068103.webp)
Brian Lo
- 15
- 4
0
votes
1 answer
Why using the most permissive setting won't allow request to get through?
I'm developing a web app with Flask & React and despite using Flask-CORS with
all the defaults unchanged (allowing for all headers and origins) requests made
from React gets rejected with Cross-Origin Request Blocked: The Same Origin Policy…
![](../../users/profiles/11796910.webp)
Mark
- 647
- 2
- 4
- 16
0
votes
2 answers
Angular cors issue :Response to preflight request doesn't pass access control check: It does not have HTTP ok status
I have an angular 8 application which makes a POST request to Flask REST API's which are hosted on IIS server(with windows Authntication). The problem is every time I do a POST request from my angular code I get CORS error:
Response to preflight…
![](../../users/profiles/15661163.webp)
AngularDev
- 11
- 3
0
votes
1 answer
how to allow cors-origin-policy in python flask socketio from react
This is my server.py file. I have used socketio to be called from react application.
async_mode = None
app = Flask(__name__)
app.debug = True
app.config['SECRET_KEY'] = 'nuttertools'
Session(app)
CORS(app)
cors = CORS(app, resources={r"*":…
![](../../users/profiles/6379197.webp)
A Stranger
- 1,816
- 2
- 24
- 58
0
votes
1 answer
Is Cloud Run removing the CORS headers from my backend?
I have developed a simple backend in Python, using Quart, Quart-CORS and SQLAlchemy. When I try the different endpoints on localhost with Postman, the CORS headers are correctly returned. As soon as I deploy it on Google Cloud Run, it seems like…
![](../../users/profiles/11196886.webp)
rafamartinc
- 123
- 1
- 6
0
votes
1 answer
Unauthorized ajax POST to backend using FlaskWTF
Introduction
Hi. In this application, i am working on flask_login, fetch(), and flask_cors to predict what clothings are being predicted. All's fine only until when i try to log in using a registered user account.
Problem
So currently, i have…
![](../../users/profiles/15111110.webp)
famousKid
- 3
- 2