Django on EB: HTTPS requests that get redirected get an HTTP location in the redirect headers #1088

Open
simonwhitaker opened this Issue Oct 29, 2012 · 0 comments

Projects

None yet

1 participant

@simonwhitaker

If I call an HTTPS URL on my EB-deployed Django app that issues a redirect, the redirect location URL uses the HTTP scheme rather than the HTTPS scheme. The root cause seems to be the same as reported in Django issue #12043.

The following middleware class solves the problem, but it would be great if this could be handled correctly by Apache instead.

class SecureRequestPropagationMiddleware(object):
    def process_request(self, request):
        if 'HTTP_X_FORWARDED_PROTO' in request.META:
            request.META['wsgi.url_scheme'] = request.META['HTTP_X_FORWARDED_PROTO']
        return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment