From f53ce87693cec29e6cd0fc464c98f5192f662983 Mon Sep 17 00:00:00 2001 From: Johannes Bornhold Date: Thu, 16 Jun 2016 11:35:55 +0200 Subject: [PATCH] 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. --- rhodecode/config/middleware.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rhodecode/config/middleware.py b/rhodecode/config/middleware.py index bdf968f2..73ed5905 100644 --- a/rhodecode/config/middleware.py +++ b/rhodecode/config/middleware.py @@ -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'])