Link to home
Start Free TrialLog in
Avatar of flynny
flynnyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Leverage Cache-Controll IIS 7.5

Hi all,

I'm running page speed to test for SEO performance on a site.

We are running IIS 7.5.

Now it's recommending we leveage browser cache-control. We have the following in the web.config

<location path="content/images">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
      </staticContent>
    </system.webServer>
  </location>
  <location path="content/css">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
      </staticContent>
    </system.webServer>
  </location>
  <location path="scripts">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
      </staticContent>
    </system.webServer>
  </location>

Open in new window


now when i view the headers in firefox. cache control is marked as private. This is why I assume it failing the page speed test. Will the fact its makred as private (even though I asusme the cache control is still being completed) affect the SEO?
Avatar of Dan McFadden
Dan McFadden
Flag of United States of America image

Here is the definition of the cache control directives by the W3C:

link:  http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1

The main difference between public and private is that it indicates whether an object can be stored in a shared cache (public) or is to only be stored for a single user (private)

You can directly control the cache directives using:

1. public
2. private
3. no-cache

Here is the tech reference to the clientCache element:

link:  http://www.iis.net/configreference/system.webserver/staticcontent/clientcache

Notice that there is a "cacheControlCustom" attribute available.  Here you can explicitly set the directive to be used.  For example:


<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />

can be

<clientCache cacheControlCustom="public/private/no-cache" cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />

Open in new window


Dan
Avatar of flynny

ASKER

Hi Dan,

Many thanks for the reply.

Ok, so caching is working then if its showing private which is fine. I misunderstoo the meaning of this.

Do you have any ideas why thepagespeed is recommending I need to leverage the browser caching?

Is it looking for a appcache manifest or something?
Avatar of flynny

ASKER

Hi Dan,

Just to add I have added the custom attribute to each to set it to public. Now when I view the header info through the browser (firefox) i have max-age=0 ??

An ideas?
Can you post the client cache object lines from your config?

Dan
Avatar of flynny

ASKER

Hi Dan,

Of Course, I have the following in my web.config now

<location path="content/images">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
      </staticContent>
    </system.webServer>
  </location>
  <location path="content/css">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
      </staticContent>
    </system.webServer>
  </location>
  <location path="scripts">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
      </staticContent>
    </system.webServer>
  </location>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dan McFadden
Dan McFadden
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial