1

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!

gou1
  • 113
  • 1
  • 3
  • You could do it, but how can you be sure the client will actually understand it? After all, the whole point of the `Accept-Encoding` header is for the client to declare that it understands the encoding. – Michael Hampton Jul 26 '12 at 16:44
  • This is why I said the client was not a Web browser: i have a unique client of which I know the capabilities. – gou1 Jul 26 '12 at 17:09

1 Answers1

0

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.

adaptr
  • 16,576
  • 23
  • 34