简体   繁体   English

mod_cache返回“损坏的过期标头”

[英]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 . 我正在使用apache2作为tomcat服务器前面的loadbalancer mod_ajpfrontend-proxy ,并通过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: 不幸的是,tomcat服务器的应用程序发回了许多标头,根据RFC,它们阻止了像pragma: no-cache这样的缓存pragma: no-cache等。但是主要问题是一条错误消息:

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. 我试图通过mod_headers来设置expires-header,但无济于事。

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. 当Magnolia返回资源并想通知浏览器不应该对其进行缓存时,它会设置几个标头: pragma: no-cachecache-control: no-storeExpires: Thu, 01 Jan 1970 00:00:00 GMT标头。

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. 由于第一个unix时间戳是1970年1月1日上午12:00:00,因此mod_cache apache模块的确给出了broken expires header消息。

The solution was to change the BrowserPolicy setting of Magnolia to include a FixedDuration expires header, but not to cache anything else. 解决方案是更改Magnolia的BrowserPolicy设置,使其包含FixedDuration expires标头,但不缓存其他任何内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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