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,
  },
}