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),
])...
Solved, thanks. It doesn't have to do with web2py. I solved it just with letsencrypt configuration.
routes_onerror = [ ('myapp/*', '/myapp/default/error_handler')]
def error_handler():
...
requested_uri = request.vars.requested_uri
if str(requested_uri)[:28] == "/.well-known/acme-challenge/" : redirect("http://mysite/filewithaccesstoletsencrypt.txt")
...