0

Sometimes my IIS server starts responding with 304 HTTP status to non-conditional requests. I have yet to determine exactly when this happens, but when it starts all browsers keep getting 304.

This is the request (debugged using fiddler):

GET http://www.example.com/aaa/bbb/GetStaticResult HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
Accept: */*
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost:12345/xxx
Origin: http://localhost:12345
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

And the response:

HTTP/1.1 304 Not Modified
Cache-Control: public
Expires: Thu, 30 Apr 2015 09:23:22 GMT
Last-Modified: Wed, 30 Apr 2014 09:23:22 GMT
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Wed, 30 Apr 2014 10:33:58 GMT

The ASP.NET MVC method is the following:

[HttpGet]
[OutputCache(Duration = int.MaxValue, VaryByParam = "")]
public string GetStaticResult()
{
    return "static";
}

The request hasn't any If-Modified-Since (or similar) header. Shouldn't the server issue a 200 response?

May be related with Getting a 304 if there is no If-Modified-Since sent?

hectorct
  • 3,335
  • 1
  • 22
  • 40
  • Did you figure this out? – Jeremy Rosenberg Dec 10 '14 at 19:04
  • I didn't, sorry. We deleted the MVC method because it was no longer necessary. – hectorct Dec 11 '14 at 18:58
  • 1
    I'm not sure if this is related, but I was looking into a similar issue when I commented on your post. It turned out to be an http.sys kernel cache fail. It ended up with 304 responses CACHED, verified using netsh http show cachestate. It seemed to happen due to IE sending a certain header in a certain way. (I believe it was one of the Accept headers with q values). Only a force refresh from an IE browser would fix the cache back to a 200. Worked around it by adding a query string ?n for the problematic static assets that were served by Cassette bundling.. – Jeremy Rosenberg Apr 30 '15 at 17:07

0 Answers0