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?
flynnyAsked:
Who is Participating?
 
Dan McFaddenSystems EngineerCommented:
From what I have read, this may be a bit of a bug/issue (loosely stated) with the SEO tool.

Question:
1. what is under the content directory?
----- If there are only 2 dirs., "images" and "css", just drop one of the location path sections and change the remaining location path section to "content."  If there are other dirs under content, I would rethink the site's directory structure so it will play nicer with SEO concepts.

Also, here is a good example of a web.config to work off of.  https://github.com/h5bp/server-configs-iis

As an example, here is a directory structure I use as a starting point whenever I start up a new project (static HTML):

- HDD-ROOT\webapps\http\website-url\yyyymmdd   *(yyyymmdd is defined as the content root in IIS for the site)
- HDD-ROOT\webapps\http\website-url\yyyymmdd\common\images
- HDD-ROOT\webapps\http\website-url\yyyymmdd\common\css
- HDD-ROOT\webapps\http\website-url\yyyymmdd\common\scripts
- HDD-ROOT\webapps\http\website-url\yyyymmdd\robots.txt
- HDD-ROOT\webapps\http\website-url\yyyymmdd\favicon.ico
- HDD-ROOT\webapps\http\website-url\yyyymmdd\index.html (default.html)

This is my (current) default website scaffolding, from here I would add additional directory off the content root, as needed.  The reason for the common directory is it allows for easier management of things like response headers and blocking of crawlers/bots that following the robots.txt convention.

In both the instances, there is only 1 directory path off the content root to manage... common.  So wherever I have to defined a path attribute, I can do so like this:

<location path="/common">
    ...
</location>

- or -

Disallow: /common/

Dan
0
 
Dan McFaddenSystems EngineerCommented:
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
0
 
flynnyAuthor Commented:
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?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
flynnyAuthor Commented:
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?
0
 
Dan McFaddenSystems EngineerCommented:
Can you post the client cache object lines from your config?

Dan
0
 
flynnyAuthor Commented:
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

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.