Headers are added in later versions of .NET Core 8 and 9 only for the Apps deployed in Windows.
Linux App:

Also referred this Doc and tried to remove the header using the Middleware class.

Thanks @Thomas Ardal for the explanation.
ASP.NETCore will return theX-Powered-Byheader. This happens when you host your website on IIS. you simply cannot remove the header in middleware, since this is out of hands forASP.NETCore.web.configto the rescue:
Output with Web.config:

Web.config file will be created in the application root directory.Also refer this blog for more details.