コンテンツにスキップ

httpAgentOptions

Node.js バージョン 18 より前では、Next.js は undici を使用して fetch() を自動的にポリフィルし、デフォルトで HTTP キープアライブ を有効にします。

サーバーサイドのすべての fetch() 呼び出しで HTTP キープアライブを無効にするには、next.config.js を開き、httpAgentOptions 設定を追加します。

next.config.js
module.exports = {
  httpAgentOptions: {
    keepAlive: false,
  },
}