letsencrypt google appengine with web2py

220 views
Skip to first unread message

Jacinto Parga

unread,
Dec 7, 2015, 9:24:48 AM12/7/15
to web2py-users
Hi,

I want to use letsencrypt ssl certificates ( https://letsencrypt.org/ ) in a web2py application deployed on GAE.

There is a good explanation about how to get it:  http://blog.seafuj.com/lets-encrypt-on-google-app-engine

But I don't know how to deploy a view like : http://www.example.com/.well-known/acme-challenge/[challenge]

I have given all steps, I have created the certificates and the keys. The only thing I need is to create a view to let letsencrypt to confirm the proper response.

In other words, I need to make this code work on web2py:
class LetsEncryptHandler(RequestHandler):

   
def get(self, challenge):
       
self.response.headers['Content-Type'] = 'text/plain'
        responses
= {
                   
'[challenge 1]': '[response 1]'
                   
'[challenge 2]': '[response 2]'
               
}
       
self.response.write(responses.get(challenge, ''))

application
= WSGIApplication([
   
('/.well-known/acme-challenge/([\w-]+)', LetsEncryptHandler),
])...

Any idea?

Jacinto Parga

unread,
Dec 14, 2015, 12:38:07 PM12/14/15
to web2py-users
Solved, thanks. It doesn't have to do with web2py. I solved it just with letsencrypt configuration.

Dave S

unread,
Dec 14, 2015, 8:00:44 PM12/14/15
to web2py-users


On Monday, December 14, 2015 at 4:38:07 AM UTC-8, Jacinto Parga wrote:
Solved, thanks. It doesn't have to do with web2py. I solved it just with letsencrypt configuration.

Thanks for posting the followup.  It's good too know you aren't sitting there lost; maybe some of the rest of us will find our way eventually   :-)

/dps


 

Jacinto Parga

unread,
Mar 6, 2016, 7:30:42 PM3/6/16
to web2py-users
With GAE deployed apps...

The best solution I've found is using an error handler and a redirection to the static file with the letsencrypt response. Something like this:

In routes.py:

routes_onerror = [
    ('myapp/*', '/myapp/default/error_handler')
]

In the error_handler controller:

def error_handler():
...
  requested_uri = request.vars.requested_uri
  if str(requested_uri)[:28] == "/.well-known/acme-challenge/" :
            redirect("http://mysite/filewithaccesstoletsencrypt.txt")
...




El lunes, 7 de diciembre de 2015, 10:24:48 (UTC+1), Jacinto Parga escribió:

Daniel Guilhermino

unread,
Jun 7, 2019, 1:59:29 AM6/7/19
to web2py-users
Dude ... thanks a lot! After hours, this answer helped me a lot!

Many... Many thanks!

Jacinto Parga

unread,
Mar 31, 2020, 11:09:11 AM3/31/20
to web2py-users
It is no longer necessary as Google appengine gives autogenerated ssl certificates if you want:

settings-mereba.png

Reply all
Reply to author
Forward
0 new messages