Skip to content
Browse files

Merge pull request #4 from nvie/master

Replace only the scheme part of the URL.
  • Loading branch information...
2 parents 348866b + 3b2f681 commit 6735984ce259aee0d042c9e36d5d79040ccd0319 @kennethreitz committed Apr 29, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 flask_sslify.py
View
7 flask_sslify.py
@@ -43,10 +43,11 @@ def redirect_to_ssl(self):
]
if not any(criteria):
- url = request.url.replace('http://', 'https://')
- r = redirect(url)
+ if request.url.startswith('http://'):
+ url = request.url.replace('http://', 'https://', 1)
+ r = redirect(url)
- return r
+ return r
def set_hsts_header(self, response):
"""Adds HSTS header to each response."""

0 comments on commit 6735984

Please sign in to comment.
Something went wrong with that request. Please try again.