Hi,
I'm trying to get the browser cache to work for html content (posts, pages, etc - disk cache is enabled and works) by providing a 304 when content hasn't changed. In other words, I want browsers to always make a request but provide a 200 + content when the page changed, and a 304 + no content when it didn't change.
In W3TC I thus disabled the Expires
header, Etag
header and everything else except the Last-Modified
header in the HTML/XML section of the Browser caching category.
However, either W3TC is misbehaving or I'm missing something. AN Etag header is always set, despite me disabling it, and a 304 is never sent. Here are request and response headers. I first cleaned the browser's cache completely. Then made two consecutive requests for the same page.
Request headers, 1st request, clean browser cache: `GET /contact HTTP/1.1
Host: [...]
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.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 OPR/20.0.1387.91
Referer: [...]
Accept-Encoding: gzip,deflate,lzma,sdch
Accept-Language: en-US,en;q=0.8`
Relevant Response headers for 1st requst:
HTTP/1.1 200 OK
Date: Sat, 19 Apr 2014 05:42:29 GMT
Server: Apache/2.4.6 (Ubuntu)
<strong>Last-Modified: Sat, 19 Apr 2014 05:42:04 GMT</strong>
<strong>ETag: "5252-4f75eb9e2e0b0-gzip"</strong>
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 6433
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
Note the Etag, which is not expected (it's disabled in W3TC).
Request headers, 2st request, same page, browser cache from 1st request:
GET /contact HTTP/1.1
Host: [...]
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.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 OPR/20.0.1387.91
Referer: [...]
Accept-Encoding: gzip,deflate,lzma,sdch
Accept-Language: en-US,en;q=0.8
Cookie: __utma=[...]; __utmb=[...]; __utmc=[...]; __utmz=[...]; qtrans_cookie_test=qTranslate+Cookie+Test; PHPSESSID=[...]
<strong>If-None-Match: "5252-4f75eb9e2e0b0-gzip"</strong>
<strong>If-Modified-Since: Sat, 19 Apr 2014 05:42:04 GMT</strong>
Response headers for 2st request:
HTTP/1.1 200 OK
Date: Sat, 19 Apr 2014 05:54:30 GMT
Server: Apache/2.4.6 (Ubuntu)
<strong>Last-Modified: Sat, 19 Apr 2014 05:42:04 GMT</strong>
<strong>ETag: "5252-4f75eb9e2e0b0-gzip"</strong>
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 6433
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
I would expect the 2nd response to be a 304, not a 200. Am I missing something?
Cheers.