使用mod_expires覆盖缓存标头

sch*_*eld 10 apache mod-expires

我想使用apache中的mod_expires模块设置cache-headers.我的配置看起来像这样:

<LocationMatch ^/static >
    ExpiresDefault "access plus 1 years"
</LocationMatch>
Run Code Online (Sandbox Code Playgroud)

问题是,文件是由我无法控制的第三个系统生成的.这些系统提供带有以下标题的文件:

Date Mon, 24 Oct 2011 08:39:02 GMT
Cache-Control no-cache,no-store,must-revalidate
Pragma no-cache
Expires Thu, 01 Dec 1994 16:00:00 GMT
Run Code Online (Sandbox Code Playgroud)

这些标头使得无法使用mod_expires设置缓存标头.http://httpd.apache.org/docs/2.2/mod/mod_expires.html告诉我们原因:

当Expires标头已经是服务器生成的响应的一部分时,例如,当由CGI脚本生成或从源服务器代理时,此模块不会更改或添加Expires或Cache-Control标头.

是否有任何可能的方法来规避此规则并使用mod_expires覆盖标头?

更新: 一种可能的解决方案是,为了避免此限制,仅使用mod_headers来设置缓存标头.不幸的是,这不是一个替代方案,因为必须计算这些值.

谢谢它提前.

sch*_*eld 4

不幸的是,这是一个已知的限制,我们不得不回退到仅使用mod_headers.