# HG changeset patch # User Johannes Bornhold # Date 2016-06-16 09:35:55 # Node ID 7237d87bf3022ea57252e995435591d21b9c1546 # Parent 9005355d6f36b18c109a0dcea05138fb85d0d018 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. diff --git a/rhodecode/config/middleware.py b/rhodecode/config/middleware.py --- a/rhodecode/config/middleware.py +++ b/rhodecode/config/middleware.py @@ -120,9 +120,6 @@ def make_app(global_conf, full_stack=Tru 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 """ 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'])