Try our conversational search powered by Generative AI!

Far-future expires headers

Vote:
 

I’m trying to set far-future expires headers on static files such as images, css and js-files. Using ISS Manager I have enabled content expiration and set the time to 365 days. This worked when we were using episerver 4.62, now when we are using episerver CMS 5 R2 SP2 it has no effect. The expiration headers are still only 12 hours. What to do?

#36583
Feb 03, 2010 15:53
Vote:
 

Hello Kristoffer,

Look in Web.config for the following line of code:

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

It sounds like you should change this setting according to your needs.

Best regards

Martin

#36590
Edited, Feb 03, 2010 18:17
Vote:
 

Hi Kristoffer

See my post: Part 8: Preparing for launch – Create an EPiServer site from scratch, under the section: Expires HTTP headers, for more information on how to do this for both IIS 6 and IIS 7.

Hope this helps.

Frederik

#36591
Feb 03, 2010 20:14
Vote:
 

Thank you. I have only tried it in our test environment, but it works like a charm.
Is it possible to do the same override on the VirtualPathVersioningProvider?

#36623
Edited, Feb 04, 2010 13:59
Vote:
 

For VPP folders you can use the method described by Martin, updating the staticFile expirationTime setting in web.config.

<location path="PageFiles">
    <system.webServer>
      <handlers>
        <add name="webresources" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" />
        <add name="wildcard" path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer" />
      </handlers>
    </system.webServer>
    <staticFile expirationTime="-1.0:0:0" />
  </location>
  <location path="Documents">
    <system.webServer>
      <handlers>
        <add name="webresources" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" />
        <add name="wildcard" path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer" />
      </handlers>
    </system.webServer>
    <staticFile expirationTime="-1.0:0:0" />
  </location>
  <location path="Global">
    <system.webServer>
      <handlers>
        <add name="webresources" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" />
        <add name="wildcard" path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer" />
      </handlers>
    </system.webServer>
    <staticFile expirationTime="-1.0:0:0" />
  </location>

#36624
Edited, Feb 04, 2010 14:30
Vote:
 

So, changing -1.0:0:0 (one day back), to 20.0:0:0 will set the expiration date to 20 days.

#36625
Feb 04, 2010 14:33
Vote:
 

Thank you!

#36626
Feb 04, 2010 15:15
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.