diff --git a/config/sample/sample-development.engine-api.ini b/config/sample/sample-development.engine-api.ini index eff6651cc6ad9309cb06d3bbcf7ecf35d84cd9c2..cb9ce5e3b95902ffe954e822cb054bddf761d8fc 100644 --- a/config/sample/sample-development.engine-api.ini +++ b/config/sample/sample-development.engine-api.ini @@ -19,7 +19,7 @@ debug_flask="false" [api] api_port=8008 - +api_cors="*" [federation] diff --git a/config/sample/sample-docker.engine-api.ini b/config/sample/sample-docker.engine-api.ini index 28e2d221133ee83fa9730ac465012c2871c9501b..084980e6a77d0e45d0103fdf5d45d39813771b5b 100644 --- a/config/sample/sample-docker.engine-api.ini +++ b/config/sample/sample-docker.engine-api.ini @@ -19,7 +19,7 @@ debug_flask="false" [api] api_port=8008 - +api_cors="*" [federation] diff --git a/config/sample/sample-production.engine-api.ini b/config/sample/sample-production.engine-api.ini index 28e2d221133ee83fa9730ac465012c2871c9501b..084980e6a77d0e45d0103fdf5d45d39813771b5b 100644 --- a/config/sample/sample-production.engine-api.ini +++ b/config/sample/sample-production.engine-api.ini @@ -19,7 +19,7 @@ debug_flask="false" [api] api_port=8008 - +api_cors="*" [federation] diff --git a/src/app.py b/src/app.py index 0c9dfb264045bbd82c83e00dec593367d5eb5e1d..65d664e05b44de3015740dbd57dc34403ddc7823 100644 --- a/src/app.py +++ b/src/app.py @@ -64,6 +64,11 @@ api = connexion.App(__name__, specification_dir='rest/swagger', arguments={'titl api.add_api('swagger.yaml', pythonic_params=True) app = build_app(api.app) +@app.after_request +def after_request(response): + header = response.headers + header['Access-Control-Allow-Origin'] = config.get("api_cors") + return response def startup(): """ diff --git a/test/config/engine-0-api.ini b/test/config/engine-0-api.ini index db55ce24228b4de9054db16c870b690d3aee8099..37ce8a513917724e0f9a30d30a3b0bed21bdcd51 100644 --- a/test/config/engine-0-api.ini +++ b/test/config/engine-0-api.ini @@ -19,7 +19,7 @@ debug_flask="false" [api] api_port=8010 - +api_cors="*" [federation] diff --git a/test/config/engine-1-api.ini b/test/config/engine-1-api.ini index f4fed4b981e2940e537e0bb7c0f42388ee45f466..69abc053aa74c20ebb01ec95be301d534e4b25f4 100644 --- a/test/config/engine-1-api.ini +++ b/test/config/engine-1-api.ini @@ -19,7 +19,7 @@ debug_flask="false" [api] api_port=8008 - +api_cors="*" [federation] diff --git a/test/config/engine-2-api.ini b/test/config/engine-2-api.ini index 19dd467326a28fc034aa79bf7efd779e9f7d9851..78e534aea860d86bd19be358370c65ad028e7242 100644 --- a/test/config/engine-2-api.ini +++ b/test/config/engine-2-api.ini @@ -19,7 +19,7 @@ debug_flask="false" [api] api_port=8009 - +api_cors="*" [federation]