Refactor https checking to a view function decorator.