I ran across this myself. No combination of INFLATE, DEFLATE and my custom filter would work. It seemed to always perform the gzip DEFLATE before handing off to my customer filter.
I'm using Apache 2.2.2. So essentially, when a gzip encoded response was received (reverse proxy mode) and passed along to my custom filter phpFilter
:
ExtFilterDefine phpFilter mode=output \
cmd="/path/my_php_filter.php"
This works just fine (I receive nice decompressed stuff, regardless of Content-Type):
SetOutputFilter INFLATE;DEFLATE
This also works (I see nice compressed stuff, or nice uncompressed stuff for non-gzip response like JSON or HTML):
SetOutputFilter phpFilter
But this doesn't work! the STDIN to my php script would always be garbled when the Content-Type was gzip.
SetOutputFilter INFLATE;phpFilter;DEFLATE
After a TON of Googling, and a little luck, this ended up working for me. I don't know why it's necessary, but adding proxy-html into the filter chain seems to force my custom filter to execute before DEFLATE.
SetOutputFilter INFLATE;phpFilter;proxy-html;DEFLATE
I know I'm answering this question 2 years too late, but hopefully this saves a day or two of headache for the next person.