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
This commit is contained in:
Michael Krotscheck 2015-10-21 11:09:41 -07:00
parent 45763e1ffb
commit 39bec27f11

View File

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