Output caching: add expires headers to Global content

 

Hi,

I'm using Episerver 7 in MVC project.

Episerver doesn't add expiration headers to Global content.

How I configured it:

Section name: <section name="staticFile" type="EPiServer.Framework.Configuration.StaticFileSection, EPiServer.Framework, Version=7.0.859.1, Culture=neutral, PublicKeyToken=8fe83dea738b45b7" allowLocation="true" />

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="365.00:00:00" />
</location>

Request URL is http://website/Global/Slideshow/picture.jpg?width=950&height=424&mode=crop
 
Response:
HTTP/1.1 200 OK
Cache-Control: public
Content-Type: image/jpeg
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 08 Jan 2013 10:02:55 GMT
Content-Length: 140335
 
As you can see max-age is not added in responce in cache-control.
 
Any ideas?
 
Thanks,
Phil
#64723 Jan 08, 2013 11:10
  •  

    I think you need to set useStaticFileSemantics to false in the VPP config section in order to use the old location elements.

    #64730 Jan 08, 2013 12:35
  •  

    Thanks for the hint Frederik. In final release this property is called useRouting. But in my case the problem was due to imageresizer plugin.

    #64737 Jan 08, 2013 15:02
  • Hai Nguyen
    Member since: 2010
     

    Hi Philous,

    I got the same issue with imageresizer. I'm wondering how did you solve the issue. Can you please share your solution?

    Thank you very much!

     

    #66509 Mar 04, 2013 7:55
  •  

    Hello Hai,

    here is my settings from webcofig for compression and expiration headers:

    <staticContent>

    <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
    </staticContent>
    <caching>
    <profiles>
    <add extension=".gif" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" location="Any" />
    <add extension=".png" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" location="Any" />
    <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" location="Any" />
    <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" location="Any" />
    <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" location="Any" />
    <add extension=".jpeg" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" location="Any" />
    </profiles>
    </caching>
    <urlCompression doStaticCompression="true" doDynamicCompression="false" dynamicCompressionBeforeCache="true" />
    <httpCompression directory="%SystemDrive%\websites\_compressed" minFileSizeForComp="1024">
    <staticTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="application/x-javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
    </staticTypes>
    <dynamicTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="application/x-javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
    </dynamicTypes>
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
    </httpCompression>
    <httpProtocol>
    <customHeaders>
    <remove name="X-Powered-By" />
    </customHeaders>
    </httpProtocol>
    <validation validateIntegratedModeConfiguration="false" />
    <rewrite>
    <outboundRules>
    <rule name="Remove ETag">
    <match serverVariable="RESPONSE_ETag" pattern=".+" />
    <action type="Rewrite" value="" />
    </rule>
    </outboundRules>
    </rewrite>

     

     

    #66581 Mar 05, 2013 17:25
  • Hai Nguyen
    Member since: 2010
     

    Thank you very much Phil, I will give it a try to see if it could help.

    #66701 Mar 07, 2013 3:14