You may receive an e-mail from your Security team after a scan, that your Web application exposing certain Response Headers that might get exploited by attackers to gain unauthorized access to the System.
While it may not always be necessary to mitigate these kind of vulnerabilities, you still have to weight the options. This might be true even for say, a Reactjs app hosted on IIS.
If you do need to remove certain Response Headers like Server, X-AspNet-version and X-Powered-By, these can be taken care of at the IIS Server level or in web.config file.
For the Server and X-Powered-By Response Headers, create Server variables as under URL Rewrite option as shown below:
Set the variable names as RESPONSE_SERVER and RESPONSE_X-POWERED-BY respectively.
Next create outbound rules using URL Re-write in IIS specifically for the Website. If you create these rules at the Server level, it’ll be applied to all Websites.
With Pre-condition set to None, make the below configuration using URL re-write in the Outbound rule. The same configuration requires to be done for RESPONSE_X-POWERED-BY server variable.
You can then test these Response Headers values should come as blank in the Dev Tools of your Browser.
For the X-AspNet-version Response Header, make the below entry in your Web.Config file. This will remove the Response Header altogether.
Add the following line in your web.config in the <system.Web> section: <httpRuntime enableVersionHeader="false" />