misc: added timeout for est connection

This commit is contained in:
Sheen Capadngan
2024-08-27 23:26:56 +08:00
parent 03cc71cfed
commit 58838c541f

View File

@@ -42,6 +42,11 @@ export const registerCertificateEstRouter = async (server: FastifyZodProvider) =
await res.hijack();
// definitive connection timeout to clean-up open connections and prevent memory leak
res.raw.setTimeout(10 * 1000, () => {
res.raw.end();
});
res.raw.setHeader(wwwAuthenticateHeader, `Basic realm="infisical"`);
res.raw.setHeader("Content-Length", 0);
res.raw.statusCode = 401;