Bug 47346 - mod_cache doesn't re-cache expired content when Last-Modified not set
Summary: mod_cache doesn't re-cache expired content when Last-Modified not set
Status: RESOLVED LATER
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_cache (show other bugs)
Version: 2.2.3
Hardware: PC Linux
: P2 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: MassUpdate
Depends on:
Blocks:
 
Reported: 2009-06-10 06:28 UTC by Filip Moritz
Modified: 2018-11-07 21:08 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Moritz 2009-06-10 06:28:25 UTC
context: caching reverse proxy with balancer setup (but only one worker yet)

All content delivered from the backend without Last-Modified header is only cached until the expiry-date is reached once although there is an future Expires header. No re-caching appears. CacheIgnoreNoLastMod does not affect this behaviour.

According to the docs (and -as far as I understand- RFC2616) an Expires-Header alone should be sufficient. Moreover CacheIgnoreNoLastMod should make caching possible even when Last-Modified header is missing.

Sounds similiar to 27791, but forcing Last-Modified to be set on the backend makes the Problem disappear.


Headers from backend triggering the problem:
---
  HTTP/1.1 200 OK
  Date: Wed, 10 Jun 2009 12:27:14 GMT
  Server: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch11 mod_ssl/2.2.3 OpenSSL/0.9.8c
  X-Powered-By: PHP/5.2.0-8+etch11
  Cache-Control: max-age=300
  Expires: Wed, 10 Jun 2009 12:32:14 GMT
  Connection: close
  Content-Type: text/html;charset=utf-8
---

after 300sec from the first access the proxy-cache keeps ignoring the cache:
---
  HTTP/1.1 200 OK
  Date: Wed, 10 Jun 2009 12:31:06 GMT
  Server: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch11 mod_ssl/2.2.3 OpenSSL/0.9.8c
  X-Powered-By: PHP/5.2.0-8+etch11
  Cache-Control: max-age=300
  Expires: Wed, 10 Jun 2009 12:36:06 GMT
  Content-Type: text/html;charset=utf-8
  Via: 1.0 www.taz.de
  Connection: close
---
  
when Last-Modified id forced on backend like:
---
  HTTP/1.1 200 OK
  Date: Wed, 10 Jun 2009 12:34:33 GMT
  Server: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch11 mod_ssl/2.2.3 OpenSSL/0.9.8c
  X-Powered-By: PHP/5.2.0-8+etch11
  Last-Modified: Wed, 10 Jun 2009 12:34:33 GMT
  Expires: Wed, 10 Jun 2009 12:39:33 GMT
  Cache-Control: max-age=300
  Connection: close
  Content-Type: text/html;charset=utf-8

... the proxy-cache behaves:
---
  HTTP/1.1 200 OK
  Date: Wed, 10 Jun 2009 12:36:48 GMT
  Server: Apache/2.2.3 (Debian)
  Last-Modified: Wed, 10 Jun 2009 12:36:34 GMT
  X-Powered-By: PHP/5.2.0-8+etch11
  Cache-Control: max-age=300
  Expires: Wed, 10 Jun 2009 12:41:34 GMT
  Via: 1.1 www.taz.de
  Age: 14
  Content-Length: 89601
  Keep-Alive: timeout=15, max=300
  Connection: Keep-Alive
  Content-Type: text/html;charset=utf-8
---

relevant config

on proxy cache machine:
---
ProxyPreserveHost On
ProxyPass / balancer://webcluster/
<Proxy balancer://webcluster>
  ...
</Proxy>
CacheEnable mem /
---

on backend
---
ExpiresActive On
ExpiresByType text/html "access plus 5 minutes"
---

The following line in my PHP app cures the desease:
---
header( "Last-Modified: ". gmdate( "D, d M Y H:i:s", time() ) ." GMT");
---

regards, Filip Moritz
Comment 1 Ruediger Pluem 2009-06-10 09:24:50 UTC
Please check if this also happens with the disk cache. The mem cache has a worse performance than the disk cache and various other drawbacks.
Comment 2 William A. Rowe Jr. 2018-11-07 21:08:18 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.