@app.before_request
def redirect_to_https():
    try:
        if request.headers["X-Forwarded-Proto"] == "https":
            pass
        else:
            return redirect(request.url.replace("http://", "https://"), 301)  # permanent
    except __HOLE__:
        #logger.debug(u"There's no X-Forwarded-Proto header; assuming localhost, serving http.")
        pass
dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/views.py/redirect_to_https