Search code examples
javascriptnode.jsexpresscreate-react-app

How to disable "X-Powered-By" response header in create-react-app?


I'm working on a react.js app using Create-react-app, in the response headers I'm seeing an Express's x-powered-by header and I want to disable this particular header field. Are there ways to achieve this? In the Next.js we can disable this header field by adding some code to config file, can we achieve the same in my scenario?


Solution

  • React is a client side framework and doesn't handle serving your application to a browser. Whatever system you are using to host your application is responsible for that header. Some of the CRA templates use webpack-dev-server for npm start which is built on Express and is probably what's showing the header. As this isn't actually part of your app, there isn't much point to turning it off even if you can.