简体   繁体   中英

mod_cache returns “broken expires header”

I am using apache2 as a loadbalancer and frontend-proxy in front of a tomcat server, connected via mod_ajp . Now, I would like to add Caching.

Unfortunately, the tomcat server's application sends back a lot of headers, which according to the RFC prevent the caching like pragma: no-cache , etc. But the main problem is an error message:

HTTP/1.1 200 OK
Date: Thu, 18 Aug 2016 09:44:33 GMT
Server: Apache/2.4.10 (Debian)
X-Magnolia-Registration: Registered
Set-Cookie: JSESSIONID=xxxxxxx; Path=/form-cms/; Secure; HttpOnly
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Content-Encoding: gzip
Vary: Accept-Encoding
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Last-Modified: Thu, 18 Aug 2016 09:44:33 GMT
Content-Language: en
X-Cache: MISS from fqdn.example.com
X-Cache-Detail: "Broken expires header: Thu, 01 Jan 1970 00:00:00 GMT" from fqdn.example.com
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html;charset=UTF-8

The cache config looks like this:

CacheRoot "/var/cache/apache2/mod_cache_disk"
CacheDirLevels 2
CacheDirLength 1
CacheMaxExpire 60
CacheDefaultExpire 60

CacheHeader on
CacheDetailHeader on

CacheIgnoreHeaders Expires
CacheIgnoreCacheControl on

CacheStoreNoStore On
CacheStorePrivat On

CacheQuickHandler off
<LocationMatch "^/my-app/.*">
    CacheEnable disk
</LocationMatch>

I am at a loss on how to solve this problem and cannot change the behaviour of the app on the tomcat server. I tried to unset the expires-header via mod_headers, but to no avail.

Any Ideas?

When Magnolia is returning a resource and would like to inform the browser, that it should not be cached, it is setting several headers: pragma: no-cache , cache-control: no-store , and an Expires: Thu, 01 Jan 1970 00:00:00 GMT header.

Since the first unix timestamp is 01/01/1970 12:00:00 am, the mod_cache apache module does give a broken expires header message.

The solution was to change the BrowserPolicy setting of Magnolia to include a FixedDuration expires header, but not to cache anything else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM