I have a server farm and ARR in front of it. If ARR disk cache is not enabled everything works as expected. Request/responses contain cache control headers, etags and when I click refresh in browser the servers in farm return 304 not modified.
When I enable Disk cache I see the files cached correctly on disk, but when ARR returns data from such disk cache it always answers with HTTP 200 OK instead of 304 not modified so the browsers downloads the same data again!
Here is request response headers when I enable disk cahe and response is served by ARR disk cache
request:
GET /~/media/Images/Catalog/Products/25312_2.png HTTP/1.1 Host: media.whatever.com Connection: keep-alive Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36 Accept-Encoding: gzip,deflate,sdch Accept-Language: cs-CZ,cs;q=0.8 If-None-Match: b630671342a345bf96d6b471ac578e65 If-Modified-Since: Thu, 22 May 2014 07:29:55 GMT
response:
HTTP/1.1 200 OK Cache-Control: public, max-age=604800 Content-Type: image/png Expires: Fri, 20 Jun 2014 10:30:20 GMT Last-Modified: Thu, 22 May 2014 07:29:55 GMT Accept-Ranges: bytes ETag: b630671342a345bf96d6b471ac578e65 Server: Microsoft-IIS/8.5 Content-Disposition: inline; filename="25312_2.png" X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET X-Powered-By: ARR/2.5 Date: Fri, 13 Jun 2014 12:02:24 GMT Content-Length: 38788
Please note same ETag, same Last-Modified yet it returns HTTP 200
And here is same one when ARR disk cache is disabled and the request hits the backend server which correctly responds with 304
GET /~/media/Images/Catalog/Products/25312_2.png HTTP/1.1 Host: media.whatever.com Connection: keep-alive Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36 Accept-Encoding: gzip,deflate,sdch Accept-Language: cs-CZ,cs;q=0.8 If-None-Match: b630671342a345bf96d6b471ac578e65 If-Modified-Since: Thu, 22 May 2014 07:29:55 GMT
HTTP/1.1 304 Not Modified Cache-Control: public, max-age=604800 Expires: Fri, 20 Jun 2014 12:07:03 GMT Last-Modified: Thu, 22 May 2014 07:29:55 GMT ETag: b630671342a345bf96d6b471ac578e65 Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET X-Powered-By: ARR/2.5 Date: Fri, 13 Jun 2014 12:07:03 GMT
I tried to modify IIS static file caching settings on ARR machine, disabled compression but with no difference.
To me it looks like this should be not related to IIS caching but looks like bug/feature of the the disk cache module as it is the logic of disk cache code to determine the file is in the cache and the etag/date is correct (?)
Anyone has this working correctly? Any tips how to troubleshoot this?