HttpAcme
HttpAcme: serving ACME HTTP-01 challenges from the files certbot writes.
A module of its own because it reads files: HttpServer declares only needs IO.NetListen, and a module that imports HttpServer must declare every module-level needs HttpServer has, so the file-reading plug cannot live there without changing what every importer must declare. HttpServer.acme_responder serves challenges from memory and needs nothing.
Functions
A plug that serves ACME HTTP-01 challenges from the directory certbot's --webroot -w <dir> writes them to: GET /.well-known/acme-challenge/<token> returns <dir>/.well-known/acme-challenge/<token> as text/plain, or 404. Tokens outside the base64url alphabet are 404, so no request can read outside that directory. Other requests pass through. Needs IO.FileRead.
Examples
HttpServer.new(443)
|> HttpServer.tls(HttpServer.TlsFiles(cert, key))
|> HttpServer.plain_listener(80, [HttpAcme.webroot("/var/www/acme"),
HttpServer.redirect_to_https(443)])