asp.nethttpcachingheaderpragma

Pragma is added to header even though I removed it from the code


As per security recommendations, I have removed Pragma settings from our site (Angular JS and ASP.Net), however, I still see it in the response headers, could be that the framework is adding it by default? any idea how can I get rid of it? Full search in the project doesn't show Pragma at all.

enter image description here


Solution

  • Well looks like this was being added 'by default', so I found out I can use URL Rewrite Module to remove Pragma from Headers, below the code

    <configuration>
    <system.webServer>
    <rewrite>
      <outboundRules>
        <rule name="Remove Pragma Header">
          <match serverVariable="RESPONSE_Pragma" pattern=".+" />
          <action type="Rewrite" value="" />
        </rule>
      </outboundRules>
     </rewrite>
    </system.webServer>
    </configuration>