-
-
Save parzibyte/c3311007bd016556f679ad81a557344b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Enable CORS. Disable it if you don't need CORS | |
""" | |
@app.after_request | |
def after_request(response): | |
response.headers["Access-Control-Allow-Origin"] = "*" # <- You can change "*" for a domain for example "http://localhost" | |
response.headers["Access-Control-Allow-Credentials"] = "true" | |
response.headers["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS, PUT, DELETE" | |
response.headers["Access-Control-Allow-Headers"] = "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization" | |
return response | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment