Force Apache HTTP compression event if no Accept-Encoding header was sent

apache-2.2compression

I have a client that sends requests to an apache server (note that the client is not a Web browser and the response is not a Web page). I would like to compress the output (probably with gzip), but I cannot modify the client to send a "Accept-Encoding: gzip" header.

So it is possible to force gzip compression of the response in apache even if no Accept-Encoding header was sent ?

Thanks!

Best Answer

You can do this in several different ways: you could fake the request header, so gzip works normally, or you could force the DEFLATE output filter onto your content.

To add a request header, look here: http://httpd.apache.org/docs/2.2/mod/mod_headers.html#requestheader

To force gzip output, look here: http://httpd.apache.org/docs/2.2/mod/mod_deflate.html, which says:

Note: There is a environment variable force-gzip, set via SetEnv, which will ignore the accept-encoding setting of your browser and will send compressed output.

Plenty of options.