# HG changeset patch # User Marcin Kuzminski # Date 1359322675 -3600 # Node ID 26bf9c8baad2357f584fd803760b65f689bededa # Parent f5dd76e2a7af3769c7bc05ab364adf3810b71148 added HSTS headers when using SSL for RhodeCode diff -r f5dd76e2a7af -r 26bf9c8baad2 rhodecode/lib/middleware/https_fixup.py --- a/rhodecode/lib/middleware/https_fixup.py Sun Jan 27 00:18:49 2013 +0100 +++ b/rhodecode/lib/middleware/https_fixup.py Sun Jan 27 22:37:55 2013 +0100 @@ -23,6 +23,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from pylons.controllers.util import Request from rhodecode.lib.utils2 import str2bool @@ -34,7 +35,11 @@ def __call__(self, environ, start_response): self.__fixup(environ) - return self.application(environ, start_response) + req = Request(environ) + resp = req.get_response(self.application) + if environ['wsgi.url_scheme'] == 'https': + resp.headers['Strict-Transport-Security'] = 'max-age=8640000; includeSubDomains' + return resp(environ, start_response) def __fixup(self, environ): """