httpAgentOptions
Node.js version 18より前のバージョンでは、Next.jsは自動的にundiciでfetch()をポリフィルし、デフォルトでHTTP Keep-Aliveを有効にします。
サーバー側のすべてのfetch()呼び出しでHTTP Keep-Aliveを無効にするには、next.config.jsを開き、httpAgentOptions設定を追加します:
next.config.js
module.exports = {
httpAgentOptions: {
keepAlive: false,
},
}