My web application is sending an AJAX request to our server using jQuery, responding in possibly large textual data. I'm using Apache and would like this data to be compressed during the transport with mod_deflate. While mod_deflate is configured on my server and works for most textual content, it doesn't seem to work with AJAX requests. I've compared the request headers coming from "regular" requests and from XHR, and the only difference is that with AJAX I'm sending an additional header:
X-Requested-With: XMLHttpRequest
In both cases, I'm sending
Accept-Encoding: gzip, deflate
(and again, all other headers are also identical) So it seems like Apache chooses to avoid compressing if it receives this header. So what I am doing wrong? Is it a configuration issue on the Apache side? I guess I can hack and remove the X-Requested-With header, but I'm not sure that the "right" way to go..
Thanks, Yaniv