config: Move HttpsFixup middleware up

Wrapping it around the Pyramid application makes SSL work. Since it also does
things with the strict transport security headers, I kept it this way for now.
Most probably we can shrink it to only contain the htsts things and use the
prefix middleware of paste.
This commit is contained in:
Johannes Bornhold 2016-06-16 11:35:55 +02:00
parent c19b05b352
commit f53ce87693

View file

@ -120,9 +120,6 @@ def make_app(global_conf, full_stack=True, static_files=True, **app_conf):
else:
app = StatusCodeRedirect(app, [400, 401, 403, 404, 500])
# enable https redirects based on HTTP_X_URL_SCHEME set by proxy
app = HttpsFixup(app, config)
# Establish the Registry for this application
app = RegistryManager(app)
@ -253,8 +250,12 @@ def wrap_app_in_wsgi_middlewares(pyramid_app, config):
"""
settings = config.registry.settings
# enable https redirects based on HTTP_X_URL_SCHEME set by proxy
pyramid_app = HttpsFixup(pyramid_app, settings)
# Add RoutesMiddleware. Currently we have two instances in the stack. This
# is the upper one to support the pylons compatibility tween during
# migration to pyramid.
pyramid_app = RoutesMiddleware(
pyramid_app, config.registry._pylons_compat_config['routes.map'])