简体   繁体   English

Apache缓存控制的最大寿命不能被覆盖

[英]Apache cache-control max-age cannot be overridden

I'm trying to set cache-control attribute on Apache 2.2 so that the client connecting wont' cache anything. 我试图在Apache 2.2上设置cache-control属性,以便连接的客户端不会缓存任何内容。 I have added various Header attributes in the httpd.conf file, however these attributes do not override the default max-age and expires header. 我在httpd.conf文件中添加了各种Header属性,但是这些属性不会覆盖默认的max-age和expires标头。 These are the values I have in httpd.conf for Header attributes: 这些是我在httpd.conf中具有的Header属性值:

   Header set Expires "Thu, 01 Dec 2003 16:00:00 GMT"
   Header set Cache-Control "no-store, no-cache, must-revalidate"
   Header set Pragma "no-cache"

The resulting headers are: 结果头是:

HTTP/1.1 200 OK
Date: Mon, 03 Dec 2012 18:06:35 GMT
Server: Apache/2.2.21 (Win32) DAV/2
Cache-Control: max-age=86400, no-store, no-cache, must-revalidate
Expires: Tue, 04 Dec 2012 18:06:36 GMT, Thu, 01 Dec 2003 16:00:00 GMT
Content-Length: 548113
Last-Modified: Fri, 14 Sep 2012 22:08:04 GMT
Vary: Accept-Encoding
Pragma: no-cache
Keep-Alive: timeout=15, max=98
Connection: Keep-Alive
Content-Type: video/f4f

So the cache-control header is still sending "max-age=86400", and appending the rest of the attributes. 因此,缓存控制标头仍在发送“ max-age = 86400”,并附加其余属性。 How can I completely override this value? 如何完全覆盖此值? I also tried to use the mod_expires module, this is the edit for httpd.conf that I made, however it didn't seem to do anything: 我还尝试使用mod_expires模块,这是我对httpd.conf所做的编辑,但是它似乎没有任何作用:

<IfModule mod_expires>
    ExpiresActive On
    ExpiresDefault 0
</IfModule>

So can anyone out there tell me how to completely override Apache's cache-control and expires headers for every request? 那么,有人可以告诉我如何完全覆盖Apache的缓存控制并使每个请求的标头过期吗? We are running Apache 2.2 on Windows for flash media streaming server. 我们正在Windows上为Flash Media Streaming Server运行Apache 2.2。 I want to override evertything because the server sends many esoteric formats depending on the client connecting to it. 我想覆盖所有内容,因为服务器会根据连接到它的客户端发送许多深奥的格式。

Thanks in advance. 提前致谢。

Try this one here: 在这里试试这个:

Header unset Expires
Header set Expires "Thu, 01 Dec 2003 16:00:00 GMT"

I read somewhere that it is bette to remove the old headers first. 我在某处读到,最好先删除旧的标头。 So the unset rule will do that. 因此,未unset规则将做到这一点。

If this not work try mod expires : 如果这不起作用,请尝试使mod过期

ExpiresActive On
ExpiresByType video/f4f "access minus 9 years" 

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

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