Richard A
Richard A

Reputation: 3

How to get firefox to cache my images?

I have tried setting:

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

Firefox still seems to not cache my images even with the above in my Web.config file. I found the following suggestion. Has anyone any idea if this will help? Anyone using something like this?

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

Upvotes: 0

Views: 530

Answers (1)

bernard
bernard

Reputation: 136

FireFox ignored the as configured by IIS.

It added the Cache-Control header max-age Ex: Cache-Control: max-age=x

I had to change my web.config to use cacheControlMode="UseExpires".

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

This configuration added the Cache-Control and Expires headers. Which seemed to tell FireFox to cache the file. Ex: Cache-Control: public Expires: Sun, 31 Dec 2034 00:00:00 GMT

Upvotes: 1

Related Questions