nextjs / latest / pages / api-reference / next-config-js / httpagentoptions.html

httpAgentOptions

In Node.js versions prior to 18, Next.js automatically polyfills fetch() with undici and enables HTTP Keep-Alive by default.

To disable HTTP Keep-Alive for all fetch() calls on the server-side, open next.config.js and add the httpAgentOptions config:

module.exports = {
  httpAgentOptions: {
    keepAlive: false,
  },
}

© 2024 Vercel, Inc.
Licensed under the MIT License.
https://nextjs.org/docs/pages/api-reference/next-config-js/httpAgentOptions