Skip to content

Conversation

@stevenday
Copy link

I've add a method to FullyQualifiedRedirectMiddleware which sniffs the scheme from the request 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants