#4 — 304 request not returning updated "expires" field resulting in unnecessary validation requests
by
Max Bloechle
—
last modified
Jan 24, 2012 07:35 PM
| State | Unconfirmed |
|---|---|
| Version: |
—
|
| Area | Functionality |
| Issue type | Bug |
| Severity | Medium |
| Submitted by | Max Bloechle |
| Submitted on | Jan 24, 2012 |
| Responsible |
—
|
| Target release: |
—
|
I am using a Apache mod_cache setup that is working really well except for once the cache content expires (images, strong caching). From now on the files are validated every time since the expired value stays in the past:
Response Headers:
Accept-Ranges bytes
Age 1
Cache-Control max-age=604800, proxy-revalidate, public
Connection Keep-Alive
Content-Length 2965
Content-Type image/png
Date Tue, 24 Jan 2012 16:59:38 GMT
Expires Tue, 03 Jan 2012 15:03:35 GMT
Keep-Alive timeout=15, max=99
Last-Modified Tue, 27 Dec 2011 14:27:10 GMT
Server Apache/2.2.16 (Debian)
X-Cache-Operation plone.app.caching.strongCaching
X-Cache-Rule plone.resource
The logs show that the Apache cache makes a request to Zope resulting in a "304: not modified" which is correct since the file has not been modified. But the problem is that the "Expires" value will not be updated in the apache cache. Disabling "Last Modified Validation" in caching setup for strong caching will change the response from a 304 to a 200 and update the "Expires" as expected.
Tests show that a 304 of zope does not return a "Expires" value which I think it should (from http://www.w3.org/[…]/rfc2616-sec10.html#sec10.3.5). My guess is that this is the reason the file does not get an updated "Expires" value in the apache cache. If zope would send a "Expires" value it would be updated in the apache cache (according to http://www.w3.org/[…]/rfc2616-sec13.html#sec13.5.3).
I am not 100% sure but it seems to be a good explanation. For now I disabled the default "Last Modified Validation" option for strong caching which avoids the issue.
Response Headers:
Accept-Ranges bytes
Age 1
Cache-Control max-age=604800, proxy-revalidate, public
Connection Keep-Alive
Content-Length 2965
Content-Type image/png
Date Tue, 24 Jan 2012 16:59:38 GMT
Expires Tue, 03 Jan 2012 15:03:35 GMT
Keep-Alive timeout=15, max=99
Last-Modified Tue, 27 Dec 2011 14:27:10 GMT
Server Apache/2.2.16 (Debian)
X-Cache-Operation plone.app.caching.strongCaching
X-Cache-Rule plone.resource
The logs show that the Apache cache makes a request to Zope resulting in a "304: not modified" which is correct since the file has not been modified. But the problem is that the "Expires" value will not be updated in the apache cache. Disabling "Last Modified Validation" in caching setup for strong caching will change the response from a 304 to a 200 and update the "Expires" as expected.
Tests show that a 304 of zope does not return a "Expires" value which I think it should (from http://www.w3.org/[…]/rfc2616-sec10.html#sec10.3.5). My guess is that this is the reason the file does not get an updated "Expires" value in the apache cache. If zope would send a "Expires" value it would be updated in the apache cache (according to http://www.w3.org/[…]/rfc2616-sec13.html#sec13.5.3).
I am not 100% sure but it seems to be a good explanation. For now I disabled the default "Last Modified Validation" option for strong caching which avoids the issue.
No responses can be added.
If you can, please log in before submitting a reaction.
