From e9191b8aad5a5528ec91c3192e6fe4559e4a351c Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 29 Apr 2012 17:34:01 -0400 Subject: [PATCH] HSTS Policy --- flask_sslify.py | 9 ++++++++- setup.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/flask_sslify.py b/flask_sslify.py index 6baa596..016d86f 100644 --- a/flask_sslify.py +++ b/flask_sslify.py @@ -25,4 +25,11 @@ class SSLify(object): if not any(criteria): url = request.url.replace('http://', 'https://') - return redirect(url) \ No newline at end of file + r = redirect(url) + + # HSTS policy. + r.headers['Strict-Transport-Security'] = 'max-age=31536000' + + return r + + diff --git a/setup.py b/setup.py index a6fe505..02c1db2 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import setup setup( name='Flask-SSLify', - version='0.1.1', + version='0.1.2', url='https://github.com/kennethreitz/flask-sslify', license='BSD', author='Kenneth Reitz',