我有一个mod_ext_filter来replace静态图像url和mod_deflate来压缩网页。
如果我使用这两个模块分开,一切工作正常。
(1.更换内容好,不压缩2.压缩内容,但没有replaceurl)
但是,如果我使用这两个模块,那么我得到垃圾和响应头没有gzip,但有Transfer-Encoding:chunked。
任何人都可以帮助我吗? 我应该试图解决哪个方面? 谢谢。
我自己碰到了这个。 没有INFLATE,DEFLATE和我的自定义filter的组合将工作。 在切换到我的客户filter之前,似乎总是执行gzip DEFLATE。
我正在使用Apache 2.2.2。 所以基本上,当一个gzip编码响应被接收(反向代理模式),并传递给我的自定义filterphpFilter :
ExtFilterDefine phpFilter mode=output \ cmd="/path/my_php_filter.php"
这工作得很好(我收到很好的解压缩的东西,无论内容types):
SetOutputFilter INFLATE;DEFLATE
这也适用(我看到很好的压缩东西,或者非Gzip响应像JSON或HTML的非压缩的东西):
SetOutputFilter phpFilter
但是这不行! 当Content-Type是gzip时,我的php脚本的STDIN总是会出现乱码。
SetOutputFilter INFLATE;phpFilter;DEFLATE
经过一段谷歌search和一点点运气,最终为我工作。 我不知道为什么它是必要的,但在filter链中添加proxy-html似乎强制我的自定义filter在 DEFLATE 之前执行。
SetOutputFilter INFLATE;phpFilter;proxy-html;DEFLATE
我知道我回答这个问题太迟了2年,但是希望这为下一个人节省了一两天的头痛。
我也刚刚碰到这个:
所以也许joinftype = N> 21也可以
# Trace the data read and written by mod_deflate # for a particular client (IP 192.168.1.31) # experiencing compression problems. # This filter will trace what goes into mod_deflate. ExtFilterDefine tracebefore \ cmd="/bin/tracefilter.pl /tmp/tracebefore" \ EnableEnv=trace_this_client # This filter will trace what goes after mod_deflate. # Note that without the ftype parameter, the default # filter type of AP_FTYPE_RESOURCE would cause the # filter to be placed *before* mod_deflate in the filter # chain. Giving it a numeric value slightly higher than # AP_FTYPE_CONTENT_SET will ensure that it is placed # after mod_deflate. ExtFilterDefine traceafter \ cmd="/bin/tracefilter.pl /tmp/traceafter" \ EnableEnv=trace_this_client ftype=21 <Directory /usr/local/docs> SetEnvIf Remote_Addr 192.168.1.31 trace_this_client SetOutputFilter tracebefore;deflate;traceafter </Directory>