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
ExtFilterDefine phpFilter mode=output \
This works just fine (I receive nice decompressed stuff, regardless of Content-Type):
This also works (I see nice compressed stuff, or nice uncompressed stuff for non-gzip response like JSON or HTML):
But this doesn't work! the STDIN to my php script would always be garbled when the Content-Type was gzip.
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.
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.