0

I have an ASP.Net Core 2.2 Web API project that is using InProcess hosting model. I need to remove certain HTTP headers from the response such as Server and X-Powered-By. All the answers I have found lead to ConfigureKestrel() or manually editing the web.config file. However:

  1. I am not using Kestrel since I am InProcess
  2. The web.config is auto-generated when publishing the app

Thanks for your help.

Pascal
  • 148
  • 11
  • Yes, `web.config` *is* autogenerated when you publish, but it is smart enough to update any existing `web.config` you might already have in your project. – Kirk Larkin Mar 20 '19 at 08:10
  • Interestingly enough, if I hit preview file on web.config then it messes it up but if I publish then it does effectively merge it. However, although I am able to remove the X-Powered-By, the _Server_ HTTP headers still shows up. – Pascal Mar 20 '19 at 16:39
  • I can get rid of the Server HTTP header by doing the following in web.config ` ` This would work for IIS10. Previous version relies on outbound rewrite rule. – Pascal Mar 21 '19 at 19:52

0 Answers0