djangosnippets.org: Latest snippets posted by xlqhttps://djangosnippets.org/users/xlq/2012-10-19T11:12:48.629453-05:00xlqHTTPS redirections middleware with updated URL template tag
2012-10-19T11:12:48.629453-05:00xlqhttps://djangosnippets.org/snippets/2833/<p>This middleware redirects HTTP requests to HTTPS for some specified URLs, in the same way as <a href="http://djangosnippets.org/snippets/85/">85</a>. It also changes the <code>url</code> template tag to use the <code>https</code> scheme for the same URLs. For example, if you have the following URL pattern:</p>
<pre><code>url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'https': True})
</code></pre>
<p>then the template: …</p>
Freely redistributable