add CORS * header to all REST api responses

php_fix
Dakota Nelson 2018-01-01 16:19:24 -07:00
parent 1781f20856
commit 20932318fb
1 changed files with 5 additions and 0 deletions

5
empire
View File

@ -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):