簡體   English   中英

mod_cache返回“損壞的過期標頭”

[英]mod_cache returns “broken expires header”

我正在使用apache2作為tomcat服務器前面的loadbalancer mod_ajpfrontend-proxy ,並通過mod_ajp連接。 現在,我想添加緩存。

不幸的是,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

緩存配置如下所示:

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>

我不知道如何解決此問題,並且無法更改雄貓服務器上應用程序的行為。 我試圖通過mod_headers來設置expires-header,但無濟於事。

有任何想法嗎?

當Magnolia返回資源並想通知瀏覽器不應該對其進行緩存時,它會設置幾個標頭: pragma: no-cachecache-control: no-storeExpires: Thu, 01 Jan 1970 00:00:00 GMT標頭。

由於第一個unix時間戳是1970年1月1日上午12:00:00,因此mod_cache apache模塊的確給出了broken expires header消息。

解決方案是更改Magnolia的BrowserPolicy設置,使其包含FixedDuration expires標頭,但不緩存其他任何內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM