Using Apache 2.0 (2.0.53) on a particular legacy system, enabling mod_deflate causes directly-served content to be gzip-encoded just fine. However, and this is my problem, content proxied from another server using ProxyPass is not getting gzip-encoded. Wireshark shows me there is no encoding header in the response and the body is in plain text.

I have another similar system, also running Apache 2.0 (2.0.52), where the proxied content IS being gzipped, and I can't find any significant difference between the configuration of the two systems.

Details: mod_deflate is being enabled using a file /etc/httpd/conf.d/deflate.conf containing:

<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json

The proxying is being done within the <VirtualHost> section using these lines:

ProxyPass /mtserver http://localhost:8000
ProxyPassReverse /mtserver http://localhost:8000

Can anyone point me at a possible reason for one system not compressing the proxied content?

  • To clarify, if you directly query the origin server the content is compressed? – jeffatrackaid Sep 4 '14 at 20:00
  • No, the origin server on localhost:8000 always supplies uncompressed. On most of my systems Apache then compresses it for me, but I can't work out why on this one system it doesn't. – Tony Mountifield Sep 4 '14 at 21:51
  • 1
    Unless you have configured your proxy to do compression, it will simply pass through what your backend is doing. Likely the other backend is serving both compressed and uncompressed content. You should either disable all compression on the backends and handle it at the proxy layer or manage compression on the backend and just let the proxy work transparently. – jeffatrackaid Sep 5 '14 at 14:15
  • The backend server is my own code (adapted from a lightweight http server), and has no compression built in. As I said, on most of my similar systems, Apache is compressing the stream fine. I just can't work out what's different on this one system - I've compared the httpd config files in detail. – Tony Mountifield Sep 5 '14 at 14:47
  • That is my point -- your proxy is not doing the compression. It is just forwarding content. Since your backend content is not compressed, then your proxied content will not be either unless specifically configure the proxy to handle the compression. – jeffatrackaid Sep 5 '14 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.