【问题标题】:How can I get Azure App Service to add a custom HTTP response header on a static site?如何让 Azure 应用服务在静态站点上添加自定义 HTTP 响应标头?
【发布时间】:2019-06-05 20:12:31
【问题描述】:

我有一个仅包含静态 html 页面的 Azure 站点。如何在响应中设置缓存控制标头?

【问题讨论】:

    标签: azure azure-web-app-service


    【解决方案1】:

    您可以使用以下代码添加自定义缓存控制标头:

    <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>  
    

    更多详情可以参考这个article

    【讨论】:

    • 谢谢! (虽然我认为不需要重定向标头位)
    猜你喜欢
    • 1970-01-01
    • 2013-09-18
    • 1970-01-01
    • 2021-12-28
    • 2019-06-10
    • 1970-01-01
    • 1970-01-01
    • 2012-11-09
    • 1970-01-01
    相关资源
    最近更新 更多