Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4 from nvie/master

Replace only the scheme part of the URL.
  • Loading branch information...
commit 6735984ce259aee0d042c9e36d5d79040ccd0319 2 parents 348866b + 3b2f681
@kennethreitz authored
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."""
Please sign in to comment.
Something went wrong with that request. Please try again.