Lunatic Fnatic
Lunatic Fnatic

Reputation: 681

How to Specify Last-Modified or ETag header to enable Cache Validation on IIS 8.5

I want to specify a cache validator for google font on IIS 8.5.

http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,300,700,600

What I did on my web.config is below;

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

I also added caching by extension

<caching>
      <profiles>
           <add extension=".woff" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="23:59:00" />
           <add extension=".ttf" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="23:59:00" />
           <add extension=".gif" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="23:59:00" />
           <add extension=".js" policy="CacheForTimePeriod" kernelCachePolicy="CacheUntilChange" duration="23:59:00" />
           <add extension=".png" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="23:59:00" />
           <add extension=".jpg" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="23:59:00" />
           <add extension=".css" policy="CacheForTimePeriod" kernelCachePolicy="CacheUntilChange" duration="23:59:00" />
      </profiles>
</caching>

But I am still not able to apply cache-validator for Google Font that I used. I am also tried to set an expire time to E.g. May 2030 for static content but Google PageSpeed didnt recognized that also. * I have managed to do it with .httaccess, and checked .htaccess topics on stackoverflow. *

Upvotes: 0

Views: 2464

Answers (1)

superscral
superscral

Reputation: 480

You can apply a cache validor only for contents that your server sevrs not external content ;-). Moreover it's a false positive because Google fonts have cache control directives:

https://redbot.org/?uri=http%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DOpen%2BSans%3A400%2C800

Upvotes: 1

Related Questions