From 39bec27f11d9a6853fa57283a6214fa5ec297145 Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Wed, 21 Oct 2015 11:09:41 -0700 Subject: [PATCH] Switched order of CORS middleware If the ACL middleware throws an exception, it's not annotated by CORS, preventing the browser from seeing the auth error. This patch reverses the order and makes sure even auth error responses are annotated. Change-Id: Ie2c05fe6a7f1eb341707311d6452aaf01b4790b3 --- ironic/api/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ironic/api/app.py b/ironic/api/app.py index 93220447b9..1854221de7 100644 --- a/ironic/api/app.py +++ b/ironic/api/app.py @@ -76,6 +76,9 @@ def setup_app(pecan_config=None, extra_hooks=None): wrap_app=middleware.ParsableErrorMiddleware, ) + if pecan_config.app.enable_acl: + app = acl.install(app, cfg.CONF, pecan_config.app.acl_public_routes) + # Create a CORS wrapper, and attach ironic-specific defaults that must be # included in all CORS responses. app = cors_middleware.CORS(app, CONF) @@ -85,9 +88,6 @@ def setup_app(pecan_config=None, extra_hooks=None): expose_headers=[Version.max_string, Version.min_string, Version.string] ) - if pecan_config.app.enable_acl: - return acl.install(app, cfg.CONF, pecan_config.app.acl_public_routes) - return app