GibboK
GibboK

Reputation: 73918

Expiration date for Cached static content

I use asp.net c# 4 and IIS 7.5.

I need to set the header for my static content on my website for caching PUBLIC for 14 days.

At the moment I use this setting in my web.config

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

As result I get a header Cache-Control:max-age=1209600

I'm testing my site with https://developers.google.com/pagespeed/ and I still get an (expiration not specified)

What I missing in my web.config to get the "Expires" attributes us output?

Thanks

Upvotes: 0

Views: 757

Answers (1)

RickNZ
RickNZ

Reputation: 18654

The "Expires" HTTP header was deprecated in HTTP 1.1 -- it's only needed by old HTTP 1.0 clients (or to satisfy tools that don't know any better).

If you really want it, you could create a simple HttpModule that identifies requests for static content and calls:

Response.Cache.SetExpires()

Upvotes: 1

Related Questions