Apache无缓存,过期

3
我正在尝试在我的网站上强制使用no-cache来处理csv文件。
根据apache的文档,我添加了以下几行到httpd.conf中:
ExpiresActive On
ExpiresDefault A0
<FilesMatch "\.(html|csv|htm)$">
ExpiresDefault A0
Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</FilesMatch>

但是当我第一次尝试获取页面时,我在 CSV 文件中得到了以下内容:
Request Method:GET  
Status Code:200 OK (from cache)  

你有任何想法,我做错了什么?!

谢谢!!

Gabi。


你尝试过使用"now"代替A0吗?另外,为什么在Header set中使用max-age=0,因为这是mod_expires应该填充的内容?你至少应该使用Header append而不是set - fge
仍然不起作用 :( - 我尝试使用“now”,并将集合更改为追加: - Gabi
<FilesMatch ".(html|csv|htm)$"> ExpiresDefault "now" Header append Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform" Header append Pragma "no-cache" </FilesMatch> - Gabi
我说过 ExpiresDefault "now" 严格等同于 Header append Cache-Control "max-age=0"。这意味着你不应该使用 Header set。你能否转储一下你在问题中收到的完整标头? - fge
@MarcB 你只需要使用“优雅重启(graceful)”,不需要完全重启(除非你有一个非常长的keepalive)。 - fge
显示剩余4条评论
1个回答

2
我检查了一下,发现我启用了Django中间件来处理缓存。我将其禁用后,现在它可以正常工作了。
抱歉 :)

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接