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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Acronis Data Cloud 7.8 Enhances Cyber Protection

A closer look at five essential enhancements that benefit end-users and help MSPs take their cloud data protection business further.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.