mysociety/commonlib — pull request #7 by stevenday (2013-07-17 12:03:56+00:00)
Title: Sniff the scheme in FullyQualifiedRedirectMiddleware rather than hardcoding it to http

I've add a method to FullyQualifiedRedirectMiddleware which sniffs the scheme from the req
uest and then uses that instead of hardcoding it. It's pretty simple, and I stole the idea
from django-sslify: https://github.com/rdegges/django-sslify. The basic idea is to rely on request.is_secure(), but I've added some extra smarts to deal with requests forwarded from a proxy too, which newer Djangos (>=1.4) deal with already, but older Djangos don't, since this is still used by mapumental on Django 1.3 from what I can see.

To use it, you don't need to add anything, but requests proxied won't be correctly identified unless you set SECURE_PROXY_SSL_HEADER as per: https://docs.djangoproject.com/en/1.4/ref/settings/#secure-proxy-ssl-header. Does this seem like a good idea?