@samitouri / QOSami-HFS / commits / 7c844300

fix: self-check not working with temporary acme challenge server

Massimo Melina committed Nov 5, 2023 at 17:41 UTC 7c844300c8abbb8303f5d8e3f724a1808a331d15
1 file changed +3 -1
src/acme.ts
+3 -1
@@ -15,7 +15,8 @@ let acmeMiddlewareEnabled = false
15 const acmeTokens: Dict<string> = {}
16 const acmeListener: RequestListener = (req, res) => { // node format
17 const BASE = '/.well-known/acme-challenge/'
18 - if (!req.url?.startsWith(BASE)) return
18 + if (!req.url?.startsWith(BASE))
19 + return res.end('HFS') // to satisfy self-check with the temporary server
20 const token = req.url.slice(BASE.length)
21 console.debug("got http challenge", token)
22 res.statusCode = HTTP_OK
@@ -56,6 +57,7 @@ async function generateSSLCert(domain: string, email?: string) {
57 accountKey: await acme.crypto.createPrivateKey(),
58 directoryUrl: acme.directory.letsencrypt.production
59 })
60 + acme.setLogger(console.debug)
61 const [key, csr] = await acme.crypto.createCsr({ commonName: domain })
62 const cert = await acmeClient.auto({
63 csr,