コンテンツへスキップ

httpAgentOptions

Node.js のバージョン 18 未満では、Next.js は自動的に `fetch()` を undici でポリフィルし、デフォルトで HTTP Keep-Alive を有効にします。

サーバー側のすべての `fetch()` 呼び出しで HTTP Keep-Alive を無効にするには、`next.config.js` を開き、`httpAgentOptions` の設定を追加します。

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