1

I am trying to understand the cache configuration below:

<!--Configures expiration for files in CMS/VPP-->
<staticFile expirationTime="12:0:0" />

<!--Configures expiration in IIS-->
<system.webServer>
   <!--Configures client headers for static files from IIS-->
   <staticContent>
       <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00"></clientCache>
   </staticContent>
   <!--Configures output and kernel caching for ALL images (both CMS and IIS)-->
   <caching>
      <profiles>
        <add extension=".gif" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".png" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".jpeg" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
      </profiles>
   </caching>
</system.webServer>
</configuration>

So the static files will be cached for 1 day as the cacheControlMaxAge="1.00:00:00". But I am confused as to why we have:

<staticFile expirationTime="12:0:0" />

And also the mime types have an expiration of 1 minute:

<caching>
      <profiles>
        <add extension=".gif" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".png" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".jpeg" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
      </profiles>
   </caching>

So does it mean that all static content is cached for 1 day or is it specific to the settings? Like any files other than the mime types is 1 day and the mime types are 1 minute.

1 Answer 1

1

<staticFile> is non-standard. That appears to be a configuration element for EPiServer.Web.StaticFileHandler. <system.webServer> is configuring IIS. Which configuration is used depends on what module is handling the request.

The documentation over at https://learn.microsoft.com is pretty good: https://learn.microsoft.com/en-us/iis/configuration/system.webserver/staticcontent/clientcache

Besides this I would say there's no better way to find out what it does / what configuration matters than to give it a try. On most browsers you can press F12 and open the developer tools. Make a request to the static files and look at the Network tab. Read the response headers, such as Cache-Control, Last-Modified, etc.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.