Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from origin 'https://xxx.com' has been blocked by CORS policy #283

Open
nanfangstation opened this issue Nov 4, 2020 · 3 comments
Open

Comments

@nanfangstation
Copy link

Hi, I recently encountered an occasional problem. Could you help me look at this problem? Thank you very much.

from origin 'https://xxx.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

from flask_cors import CORS
CORS(app, resources=[r'/survey/platform/*', r'/athena/survey/platform/*'], supports_credentials=True)

image

@nejat-njonjo
Copy link

This error is sometimes caused by uncaught exceptions in your program.

Try this:

CORS(app, resources={r'/athena/*': {origins: '*'}})

@bacarPereira
Copy link

In my case the cors configuration was correct. I had to change the PROPAGATE_EXCEPTIONS attribute to false in the app settings.

app = Flask(__name__)
app.config['PROPAGATE_EXCEPTIONS'] = False

PROPAGATE_EXCEPTIONS
Exceptions are re-raised rather than being handled by the app’s error handlers. If not set, this is implicitly true if TESTING or DEBUG is enabled.
Default: None

@kurtmckee
Copy link
Contributor

@corydolphin I recommend closing this issue due to its age.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants