Question

I had asked a few questions regarding compressing HTTP Request headers here and here but I some how skipped the HTTP response part... I am looking for a way to reduce/compact the headers in my HTTP response...
The situation is that I am communicating a Java ME app with a remote Server and any extra baggage is causing me to shed out loads of $$...
Presuming both the client and server are under my control what solution would you'll suggest?

Was it helpful?

Solution

The same general mechanisms for compressing requests apply to responses. And once again, the headers themselves are not compressible ... only the response content can be compressed in an HTTP 1.1 compliant implementation.

The way to specify that the server should compress the response is to set an "Accept-encoding" header, as described in section 14.3 of the HTTP 1.1 spec. However, you are at the mercy of the service implementation as to whether it will actually compress the response for you. If the server cannot / will not compress as you have asked, it may send a 406 Not Acceptable response. Alternatively, a crufty server-side HTTP implementation may ignore your Accept-* headers and send the response uncompressed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top