Peter Morris
Peter Morris

Reputation: 23224

How can I get Azure App Service to add a custom HTTP response header on a static site?

I have an Azure site that consists only of static html pages. How can I set the cache-control header in the response?

Upvotes: 1

Views: 3956

Answers (1)

Joey Cai
Joey Cai

Reputation: 20067

You could use the following code to add your custom cache-control header:

<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <clear /> <!-- Gets rid of the other unwanted headers -->
        <add name="cache-control" value="XXXXX" />
      </customHeaders>
      <redirectHeaders>
        <clear />
      </redirectHeaders>
    </httpProtocol>    
  </system.webServer>
</configuration>  

For more details, you could refer to this article.

Upvotes: 5

Related Questions