Skip to content

Instantly share code, notes, and snippets.

@an01f01
Created February 11, 2021 20:55
Show Gist options
  • Save an01f01/b48a8f9fed35eb6a57ce1303244f3330 to your computer and use it in GitHub Desktop.
Save an01f01/b48a8f9fed35eb6a57ce1303244f3330 to your computer and use it in GitHub Desktop.
"""
Overriding the prepare method of the RequestHandler to redirect based on protocol
"""
def prepare(self):
if self.request.protocol == 'http':
self.redirect('https://' + self.request.host, permanent=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment