Capítulo 404 de 456

httpAgentOptions

Core Idea

Controls whether Next.js polyfills fetch() with HTTP Keep-Alive enabled on Node.js versions before 18.

Key Concepts

  • httpAgentOptions.keepAlive: boolean; set false to disable HTTP Keep-Alive for all server-side fetch() calls.

Code Examples

module.exports = {
  httpAgentOptions: {
    keepAlive: false,
  },
}
  • O que demonstra: desabilita Keep-Alive globalmente no fetch server-side.

Key Takeaways

  1. Só relevante em Node < 18, onde Next.js polyfilla fetch() com undici e habilita Keep-Alive por padrão.

Connects To

  • Supported browsers/polyfills: contexto do polyfill undici mencionado aqui.