iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🔋

Removing the x-powered-by header in a Next.js custom server

に公開

I struggled with how to disable x-powered-by in Next.js, so I'm writing this down for the record.

  • Disabling it on the Express side doesn't work!
    • Even with express().disable('x-powered-by'), it gets overwritten by Next.
  • Set it in next.config.js!
module.exports = {
  poweredByHeader: false,
};

Official Doc

https://nextjs.org/docs/api-reference/next.config.js/disabling-x-powered-by

Discussion