add CORS * header to all REST api responses
parent
1781f20856
commit
20932318fb
5
empire
5
empire
|
@ -223,6 +223,11 @@ def start_restful_api(empireMenu, suppress=False, username=None, password=None,
|
||||||
if (token != apiToken) and (token != permanentApiToken):
|
if (token != apiToken) and (token != permanentApiToken):
|
||||||
return make_response('', 401)
|
return make_response('', 401)
|
||||||
|
|
||||||
|
@app.after_request
|
||||||
|
def add_cors(response):
|
||||||
|
response.headers['Access-Control-Allow-Origin'] = '*'
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
@app.errorhandler(Exception)
|
@app.errorhandler(Exception)
|
||||||
def exception_handler(error):
|
def exception_handler(error):
|
||||||
|
|
Loading…
Reference in New Issue