2011-06-27 29 views
0

我曾嘗試設置:如何讓Firefox來緩存我的圖片?

<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" /> 

火狐似乎仍然不緩存我的圖像,即使在我的Web.config文件上面。我發現了以下建議。有沒有人有任何想法,如果這將有助於?任何人使用這樣的東西?

<location path="MyWebsite"> 
    <system.webServer> 
     <caching> 
      <profiles> 
       <add extension=".html" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
       <add extension=".htm" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
       <add extension=".gif" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
       <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
       <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
       <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
       <add extension=".jpeg" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
      </profiles> 
     </caching> 
    </system.webServer> 
</location> 

回答

1

FireFox忽略了IIS的配置。

它增加了Cache-Control頭max-age的 例如:緩存控制:最大年齡= X

我不得不改變我的web.config使用cacheControlMode = 「UseExpires」。

<system.webServer> 
    <staticContent> 
     <clientCache cacheControlCustom="public" cacheControlMode="UseExpires" httpExpires="Sun, 31 Dec 2034 00:00:00 GMT"/> 
    </staticContent> 
    </system.webServer> 

該配置添加了Cache-Control和Expires標頭。這似乎告訴FireFox緩存文件。 例如: 緩存控制:公開 有效期至:2034年12月31日星期日0034:00 GMT

+0

另請注意,如果Firebug設置爲禁用緩存 –