diff --git a/etc/gnocchi/api-paste.ini b/etc/gnocchi/api-paste.ini index 451243b95..cb7becb00 100644 --- a/etc/gnocchi/api-paste.ini +++ b/etc/gnocchi/api-paste.ini @@ -13,10 +13,10 @@ use = egg:Paste#urlmap /v1 = gnocchiv1+auth [pipeline:gnocchiv1+noauth] -pipeline = cors gnocchiv1 +pipeline = gnocchiv1 [pipeline:gnocchiv1+auth] -pipeline = cors keystone_authtoken gnocchiv1 +pipeline = keystone_authtoken gnocchiv1 [app:gnocchiversions] paste.app_factory = gnocchi.rest.app:app_factory @@ -29,7 +29,3 @@ root = gnocchi.rest.V1Controller [filter:keystone_authtoken] paste.filter_factory = keystonemiddleware.auth_token:filter_factory oslo_config_project = gnocchi - -[filter:cors] -paste.filter_factory = oslo_middleware.cors:filter_factory -oslo_config_project = gnocchi diff --git a/gnocchi/rest/app.py b/gnocchi/rest/app.py index 2417166e2..5b1c13ed0 100644 --- a/gnocchi/rest/app.py +++ b/gnocchi/rest/app.py @@ -18,6 +18,7 @@ import uuid from oslo_config import cfg from oslo_log import log +from oslo_middleware import cors from oslo_policy import policy from paste import deploy import pecan @@ -128,7 +129,8 @@ def _setup_app(root, conf, indexer, storage, not_implemented_middleware): def app_factory(global_config, **local_conf): global APPCONFIGS appconfig = APPCONFIGS.get(global_config.get('configkey')) - return _setup_app(root=local_conf.get('root'), **appconfig) + app = _setup_app(root=local_conf.get('root'), **appconfig) + return cors.CORS(app, conf=appconfig['conf']) def build_wsgi_app():