Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
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
add comment

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
Many thanks, it worked great with force-gzip ! –  gou1 Jul 26 '12 at 17:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.