Skip to content

Instantly share code, notes, and snippets.

@mitchellbusby
Created July 31, 2016 00:09
Show Gist options
  • Save mitchellbusby/8b03ade118ac5309f9261fbc19168a0a to your computer and use it in GitHub Desktop.
Save mitchellbusby/8b03ade118ac5309f9261fbc19168a0a to your computer and use it in GitHub Desktop.
Heroku + Flask + LetsEncrypt Verification Step
#Vaguely follows this guide but with python http://collectiveidea.com/blog/archives/2016/01/12/lets-encrypt-with-a-rails-app-on-heroku/
@app.route('/.well-known/acme-challenge/<id>')
def acme_challenge(id):
return "%s.%s" % (id, os.environ.get('ACME_CHALLENGE', 'ACME CHALLENGE VARIABLE IS NOT SET'))
@davidrpmorris
Copy link

Found this through google but couldn't get it to work, so I used this instead from https://medium.com/@ericwuehler/using-let-s-encrpyt-9175feb76632#.h10bxcywx:

@app.route('/.well-known/acme-challenge/<challenge>')
def letsencrypt_check(challenge):
    challenge_response = {
        "<challenge_token>":"<challenge_response>",
        "<challenge_token>":"<challenge_response>"
    }
    return Response(challenge_response[challenge], mimetype='text/plain')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment