Merge "Added CORS support to Neutron"
This commit is contained in:
@@ -5,8 +5,8 @@ use = egg:Paste#urlmap
|
|||||||
|
|
||||||
[composite:neutronapi_v2_0]
|
[composite:neutronapi_v2_0]
|
||||||
use = call:neutron.auth:pipeline_factory
|
use = call:neutron.auth:pipeline_factory
|
||||||
noauth = request_id catch_errors extensions neutronapiapp_v2_0
|
noauth = cors request_id catch_errors extensions neutronapiapp_v2_0
|
||||||
keystone = request_id catch_errors authtoken keystonecontext extensions neutronapiapp_v2_0
|
keystone = cors request_id catch_errors authtoken keystonecontext extensions neutronapiapp_v2_0
|
||||||
|
|
||||||
[filter:request_id]
|
[filter:request_id]
|
||||||
paste.filter_factory = oslo_middleware:RequestId.factory
|
paste.filter_factory = oslo_middleware:RequestId.factory
|
||||||
@@ -14,6 +14,13 @@ paste.filter_factory = oslo_middleware:RequestId.factory
|
|||||||
[filter:catch_errors]
|
[filter:catch_errors]
|
||||||
paste.filter_factory = oslo_middleware:CatchErrors.factory
|
paste.filter_factory = oslo_middleware:CatchErrors.factory
|
||||||
|
|
||||||
|
[filter:cors]
|
||||||
|
paste.filter_factory = oslo_middleware.cors:filter_factory
|
||||||
|
oslo_config_project = neutron
|
||||||
|
latent_allow_headers = X-Auth-Token, X-Openstack-Request-Id
|
||||||
|
latent_expose_headers = X-Auth-Token, X-Openstack-Request-Id
|
||||||
|
latent_allow_methods = GET, PUT, POST, DELETE, PATCH
|
||||||
|
|
||||||
[filter:keystonecontext]
|
[filter:keystonecontext]
|
||||||
paste.filter_factory = neutron.auth:NeutronKeystoneContext.factory
|
paste.filter_factory = neutron.auth:NeutronKeystoneContext.factory
|
||||||
|
|
||||||
|
@@ -13,6 +13,7 @@ namespace = oslo.db
|
|||||||
namespace = oslo.policy
|
namespace = oslo.policy
|
||||||
namespace = oslo.concurrency
|
namespace = oslo.concurrency
|
||||||
namespace = oslo.messaging
|
namespace = oslo.messaging
|
||||||
|
namespace = oslo.middleware.cors
|
||||||
namespace = oslo.service.sslutils
|
namespace = oslo.service.sslutils
|
||||||
namespace = oslo.service.wsgi
|
namespace = oslo.service.wsgi
|
||||||
namespace = keystonemiddleware.auth_token
|
namespace = keystonemiddleware.auth_token
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
from keystonemiddleware import auth_token
|
from keystonemiddleware import auth_token
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
from oslo_middleware import cors
|
||||||
from oslo_middleware import request_id
|
from oslo_middleware import request_id
|
||||||
import pecan
|
import pecan
|
||||||
|
|
||||||
@@ -74,4 +75,17 @@ def _wrap_app(app):
|
|||||||
else:
|
else:
|
||||||
raise n_exc.InvalidConfigurationOption(
|
raise n_exc.InvalidConfigurationOption(
|
||||||
opt_name='auth_strategy', opt_value=cfg.CONF.auth_strategy)
|
opt_name='auth_strategy', opt_value=cfg.CONF.auth_strategy)
|
||||||
|
|
||||||
|
# This should be the last middleware in the list (which results in
|
||||||
|
# it being the first in the middleware chain). This is to ensure
|
||||||
|
# that any errors thrown by other middleware, such as an auth
|
||||||
|
# middleware - are annotated with CORS headers, and thus accessible
|
||||||
|
# by the browser.
|
||||||
|
app = cors.CORS(app, cfg.CONF)
|
||||||
|
app.set_latent(
|
||||||
|
allow_headers=['X-Auth-Token', 'X-Openstack-Request-Id'],
|
||||||
|
allow_methods=['GET', 'PUT', 'POST', 'DELETE', 'PATCH'],
|
||||||
|
expose_headers=['X-Auth-Token', 'X-Openstack-Request-Id']
|
||||||
|
)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
Reference in New Issue
Block a user