[core] Add CORS headers
This commit is contained in:
parent
a479d0c0ee
commit
2b93404dc0
|
@ -108,6 +108,14 @@ def create_app(test_config=None):
|
||||||
|
|
||||||
return jsonify({"plugins": app.config["FG_PLUGINS"], "version": version})
|
return jsonify({"plugins": app.config["FG_PLUGINS"], "version": version})
|
||||||
|
|
||||||
|
@app.after_request
|
||||||
|
def after_request(response):
|
||||||
|
header = response.headers
|
||||||
|
header['Access-Control-Allow-Origin'] = '*'
|
||||||
|
header["Access-Control-Allow-Methods"] = "GET,HEAD,OPTIONS,POST,PUT"
|
||||||
|
header["Access-Control-Allow-Headers"] = "Origin, X-Requested-With, Content-Type, Accept, Authorization"
|
||||||
|
return response
|
||||||
|
|
||||||
@app.errorhandler(Exception)
|
@app.errorhandler(Exception)
|
||||||
def handle_exception(e):
|
def handle_exception(e):
|
||||||
if isinstance(e, HTTPException):
|
if isinstance(e, HTTPException):
|
||||||
|
|
Loading…
Reference in New Issue