[英]Apache 2.4 mod_cache + mod_cache_disk + modjk: 304 Not Modified, but Content-Length modified
我对mod_cache感到疯狂!
我当前的设置:
Ubuntu上的Apache 2.4,具有:
-mpm_worker
-mod_jk
-mod_cache
-mod_cache_disk
-mod_expires
-mod_deflate
HTTP和HTTPS请求通过modjk平衡到5个Tomcat AppServer。 我想缓存由Tomcat实例提供的媒体资产,但是在使用mod_cache时遇到了麻烦。
我当前的缓存配置:
CacheRoot /srv/volatile/cache
CacheDirLevels 3
CacheDirLength 2
CacheEnable disk /medias
# Currently active:
CacheQuickHandler off
CacheLock on
CacheLockPath /tmp/mod_cache-lock
CacheLockMaxAge 5
CacheIgnoreHeaders Set-Cookie
# This is another configuration i tried:
#CacheIgnoreNoLastMod On
#CacheIgnoreCacheControl On
#CacheIgnoreQueryString On
#CacheIgnoreHeaders Set-Cookie
我检查了很多教程和指南,但没有成功。
Apache可以很好地满足第一个请求,之后的请求却失败,并出现奇怪的错误:
Recalled cached URL info header https://...
Recalled headers for URL https://...
Adding CACHE_SAVE filter for /medias...
Adding CACHE_REMOVE_URL filter for /medias...
cache: /media... responded with an uncacheable 304, retrying the request. Reason: contradiction: 304 Not Modified, but Content-Length modified
cache: Removing url https://
Deleting /srv/volatile/cache/.../.header from cache.
Deleting /srv/volatile/cache/.../.data from cache.
Deleting directory /srv/volatile/cache/.../7n from cache.
URL https://... failed the size check (0 < 1)
我认为这可能是负载平衡的问题,因为步行引发了多个节点或类似的事件,但是这种行为不是确定性的。 使用apache-bench&jmeter进行的测试显示60-70%的请求失败,因此并不是每个X请求都失败。
如果设置了CacheIgnoreCacheControl On选项,则请求引发的jmeter&apache-bench不会失败,但是访问引发的浏览器失败。
有人知道吗?
谢谢陶朗特
我认为,这已由mod_cache错误56881覆盖, 该错误已在Apache 2.4.11中修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.