No expires header

Posted by Tom Gullen on Stack Overflow See other posts from Stack Overflow or by Tom Gullen
Published on 2011-07-10T23:12:23Z Indexed on 2012/03/21 5:30 UTC
Read the original article Hit count: 298

Filed under:
|
|

I have the report from YSlow:

(no expires) http://static3.scirra.net/avatars/128/40cfdcbd1b1ec1842e199c97c4b85a4a.png

(And a lot more similar). In my web.config though, I have:

    <system.webServer>
            <staticContent>
                <clientCache httpExpires="Sun, 29 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" />
            </staticContent>
            <caching>
                <profiles>
                    <add extension=".ashx" policy="CacheForTimePeriod"  kernelCachePolicy="DontCache" duration="01:00:00" />
                    <add extension=".png" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" location="Any" />
                </profiles>
            </caching>
        <rewrite>
            <rules>
                <rule name="Avatar">
                    <match url="avatars/([0-9]+)/(.*).png" />
                    <action type="Rewrite" url="gravatar.ashx?hash={R:2}&amp;size={R:1}" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>

Should this not be adding the expires header correctly? My objectives are:

  • Gravatar.ashx fetches image from Gravatar server
  • Server caches result for 1 hour (similar to SO)
  • Expires header is added so client doesn't keep fetching it from my server

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET