我有这个文件的文件夹:channel.html
在同一个文件夹中,我有这个.htaccess文件
<Files channel.html> ExpiresActive On ExpiresDefault A31536000 Header set Cache-Control "max-age=31536000" </Files>
curl -I /channel.html:
HTTP/1.1 200 OK Date: Wed, 09 Nov 2011 17:27:30 GMT Server: Apache Accept-Ranges: bytes X-Mod-Pagespeed: 0.9.18.7-900 Cache-Control: max-age=0, no-cache, no-store Vary: Accept-Encoding Content-Length: 59 Content-Type: text/html
如果我在.htaccess上添加ForceType text/plain ,它应该可以正常工作,但显然是错误的Content-Type 。
我应该怎么做才能解决或debugging这个烦恼?
由于Expires标题是为text / plain而不是text / html工作的,您是否尝试过添加ExpiresByType text/html "access plus 1 year" ? 或者,在其他地方search其他configuration以获取ExpiresByType text/html指令,这将覆盖默认值?
您可能需要重置您的标题。 如果这是一个脚本而不是直接的静态内容,那么你的web应用程序也可能会设置caching标题。
另外,我看到你正在使用mod_page的速度。 我知道它试图做一些优化,也许它也为你设置标题。
我会试试这个:头部取消你的.htaccess中的Cache-Control,看看你是否仍然得到一个Cache头。 如果你这样做,那么你知道caching头正在其他地方注入。
通过改变MIME /types,它表明无论是设置头是这样做的文本/ HTML,所以它不接触文本/纯文本。
你有没有启用标题重写? 如果你能发现无效的命令'ExpiresActive',可能是拼错或定义的模块不包括在服务器configuration
在apache2 / error.log中,那么你可能想要运行sudo a2enmod头文件
build议在https://stackoverflow.com/questions/8260738/ruby-on-rails-3-1-leverage-browser-caching