I'm trying to have a basic behavior regarding my caching strategy: files should be cached, and revalidated with server each time. So I would like Apache to send a 304 back.
Here is the dialog that happens for each browser refresh:
Status Code:200 OK Request Headers Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding:gzip,deflate,sdch Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4 Cache-Control:max-age=0 Connection:keep-alive Cookie: ... Host:... If-Modified-Since:Tue, 14 Oct 2014 15:10:37 GMT If-None-Match:"1461-505636af08fcd-gzip" User-Agent:Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36 Response Headers Accept-Ranges:bytes Cache-Control:No-cache Connection:Keep-Alive Content-Encoding:gzip Content-Length:1412 Content-Type:text/html Date:Tue, 14 Oct 2014 16:58:05 GMT ETag:"1461-505636af08fcd-gzip" Keep-Alive:timeout=5, max=99 Last-Modified:Tue, 14 Oct 2014 15:10:37 GMT Server:Apache/2.4.6 (Ubuntu) Vary:Accept-Encoding
(this is from chrome devtools, with Disable cache unchecked)
You can see that the response contains the Cache-Control:No-cache Header, and that the If-modified-since header matches the Last-modified. The ETag matches too.
Shouldn't Apache sends a 304 in that case ?
Disabling ETags in apache with
Header unset ETag
makes the caching behavior more predictible...