跳到內容
配置next.config.jshttpAgentOptions

httpAgentOptions

在 Node.js 18 之前的版本中,Next.js 會自動使用 undicifetch() 新增 Polyfill,並預設啟用 HTTP Keep-Alive

要停用伺服器端所有 fetch() 呼叫的 HTTP Keep-Alive,請開啟 next.config.js 並新增 httpAgentOptions 配置。

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