From 29e7be74f5a61bb4b65f09236212acfde801e99b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 14 Mar 2024 12:28:08 +0100 Subject: [PATCH] disable early hints when there is no environment value set for it --- server/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/index.ts b/server/index.ts index 9e8991c..ec34105 100644 --- a/server/index.ts +++ b/server/index.ts @@ -80,7 +80,7 @@ async function startServer() { next() } else { const { body, statusCode, headers, earlyHints } = httpResponse - if (res.writeEarlyHints) + if (process.env.EARLY_HINTS && res.writeEarlyHints) res.writeEarlyHints({ link: earlyHints.map((e) => e.earlyHintLink) }) headers.forEach(([name, value]) => res.setHeader(name, value)) res.status(statusCode)