mod_deflate - 似乎无法设置内容编码标头
我正在尝试设置 mod_deflate 来提供压缩的 css/js/html 内容,但很难让 apache 正确发送“内容编码”标头。
我已尝试以下操作,将其放在 Web 根目录中的 .htaccess 文件中:
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript application/javascript text/javascript text/css application/xml
但是,检查标题使用 firebug,它似乎不起作用,即使它在我的 MAMP 本地副本上起作用。
有什么想法吗?
I am trying to set up mod_deflate to deliver compressed css/js/html content, but am having difficulty getting apache to send the 'content-encoding' header correctly.
I have tried the following, placed in my .htaccess file in the web root:
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript application/javascript text/javascript text/css application/xml
but, checking the headers using firebug, it doesn't appear to be working, even though it does on my local copy of MAMP.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的交付服务器上使用的是哪个版本的 Apache?我相信
AddOutputFilterByType
在版本 > 中已被弃用。 2.1.但是,您仍然可以完成此操作,只需再添加几行:DEFLATE
过滤器具有对no-gzip
环境变量的内置检查。因此,这是打开DEFLATE
过滤器,然后关闭所有内容,然后通过取消设置css|js|html
文件重新打开它>no-gzip 过滤这些请求。希望有帮助。
Which version of Apache are you using on your delivery server? I believe the
AddOutputFilterByType
is deprecated in versions > 2.1. However, you can still accomplish this, just a few more lines:The
DEFLATE
filter, has a built-in check of theno-gzip
environment variable. So, this is turning on theDEFLATE
filter, then turning it off for everything, then turning it back on forcss|js|html
files by un-setting theno-gzip
filter for those requests.Hope that helps.