@samitouri / QOSami-HFS / commits / 052f6196

fix: (regression 0.49.2) automatic certificate renewal prevented server from working for a few seconds

Massimo Melina committed Mar 17, 2024 at 10:53 UTC 052f61963035f016268db87c63d4857d266abac7
1 file changed +2 -2
src/acme.ts
+2 -2
@@ -15,8 +15,7 @@ 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))
19 - return res.end('HFS') // to satisfy self-check with the temporary server
18 + if (!req.url?.startsWith(BASE)) return
19 const token = req.url.slice(BASE.length)
20 console.debug("got http challenge", token)
21 res.statusCode = HTTP_OK
@@ -68,6 +67,7 @@ async function generateSSLCert(domain: string, email?: string, altNames?: string
67 async challengeCreateFn(_, c, ka) { acmeTokens[c.token] = ka },
68 async challengeRemoveFn(_, c) { delete acmeTokens[c.token] },
69 })
70 + console.log("acme certificate generated")
71 return { key, cert }
72 }
73 finally {