Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Below are the request and response headers for a page in my web application:

Request Headers:

GET http://my-server/myapp/mypage.aspx?myid=123 HTTP/1.1
Accept: */*
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
UA-CPU: AMD64
Accept-Encoding: gzip, deflate
Host: my-server
Connection: Keep-Alive
Pragma: no-cache
Cookie: <sanitized>

Response Headers:

HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 173788
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Thu, 15 Jul 2010 17:48:25 GMT

IE8 and Firefox seem to ignore cached copies of this page. Both browsers send the same unconditional requests every time I load the page. I have verified that IE8 does at least cache the response in the "Temporary Internet Files" directory.

From what I understand, Cache-Control: private should instruct both browsers to cache the response. Since there is no expiration info, they should send conditional requests to validate the cached copy for later requests, but this isn't happening. Is there some browser-level heuristic rejecting the cached copy (or preventing caching at all)? Or is my understanding of the headers simply wrong?

The web server involved is IIS 7.5 running on Windows 7 Enterprise. The browsers are IE 8 and Firefox 3.6.6, running as administrator on the same machine as IIS (the requests are made to the machine's host name, not localhost).

Interestingly, IE9 Platform Preview 3 doesn't even send a conditional request - it blindly reuses the cached copy!

share|improve this question
1  
its been very long time since I've looked at this stuff but doesn't the Pragma: no-cache pretty much do this. –  tony roth Jul 15 '10 at 19:24
    
Umm...wow, yes, thanks for pointing out the obvious to me. Sometimes you just need a second pair of eyes I guess. :P Post this as an answer and I'll accept it. –  Annabelle Jul 19 '10 at 16:57
add comment

2 Answers

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1 says "A private (non-shared) cache MAY cache the response."

I guess everything is the MAY, you can only sure that the page will not be cached in a public cache not that the page will be cached

share|improve this answer
add comment

Try responding with an Expires header.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.