我的最大年龄标头来自哪里? [英] Where is my max-age header coming from?

查看:105
本文介绍了我的最大年龄标头来自哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很清楚自己该如何设置,但是我担心要在两个不同的位置进行配置。要获得赏金,请告诉我应该在哪里找到现有设置。

I'm well aware of how I could set it myself, but I am concerned about having it configured in two different places. To receive the bounty, please tell me where I should look to find the existing setting.

我们已经在寻找现有设置的地方,但没有成功:

Places we've already looked for the existing setting, without success:


  • web.config < StaticContent> 部分

  • IIS输出缓存部分,位于所有三个级别:


    • 计算机

    • 站点

    • 应用程序

    • the web.config <StaticContent> section
    • IIS output caching section, at all three levels:
      • machine
      • site
      • application

      我们最近注意到我们的CSS和JS文件没有刷新。当我检查网络流量时,它们从服务器返回,并带有标头( Cache-Control:max-age = 604800 ),该标头的使用寿命为7天。

      We recently noticed that our CSS and JS files aren't getting refreshed. When I inspect the network traffic, they are coming back from the server with a header (Cache-Control: max-age=604800) that gives them a seven-day lifespan.

      我们需要减少缓存寿命。但是对于我一生来说,我找不到设置的位置。

      We need to reduce the cache lifetime. But for the life of me I can't find where it is set.

      在web.config <$ c中设置了 not $ c>< StaticContent> 部分。

      It is not set in the web.config <StaticContent> section.

      在IIS输出缓存部分未设置 (我在机器,站点和应用程序下查看-它们都是空白)。

      It is not set in the IIS output caching section (I looked under the machine, the site, and the application-- they are all blank).

      代码中没有设置 在全局代码中搜索 SetMaxAge 并得到了疯子。
      我还能在哪里看?

      It is not set in code-- I did a global code search for SetMaxAge and got nuthin'. Where else can I look?

      是否有可能由数据中心的网关或负载均衡器设置?

      Is it possible it is being set by the gateway or load balancer in our data center?

      推荐答案

      您可以在Web配置中执行此操作,也可以使用IIS ui进行更改(请参见下面的链接):

      You can do like this in web config, or you can use IIS ui to change (see link below):

      <configuration>
        <system.webServer>
          <staticContent>
             <clientCache cacheControlMode="UseMaxAge"
              cacheControlMaxAge="1.00:00:00" /> <!-- 1 day -->
          </staticContent>
        </system.webServer>
      </configuration>
      

      在此处查看更多信息: https://www.iis.net/configreference/system.webserver/staticcontent/clientcache

      See more here: https://www.iis.net/configreference/system.webserver/staticcontent/clientcache

      IIS文档指出默认值为1天。

      IIS documentation states that the default value is 1 day.

      还有其他一些方法可以影响这些设置:
      http:/ /www.galcho.com/blog/post/2008/02/27/IIS7-How-to-set-cache-control-for-static-content.aspx

      Here are some other ways what could have affect these settings: http://www.galcho.com/blog/post/2008/02/27/IIS7-How-to-set-cache-control-for-static-content.aspx


      • overrideModeapplicationApplication.config中的默认值

      • 早期的appcmd.exe设置

      • 或客户端设置也可以覆盖您的值。

      这篇关于我的最大年龄标头来自哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆