How do I configure/enable HTTP gzip compression with Apigee?
I'm interested in having Apigee handle gzip content-encoding for my back-end servers which do not return compressed data. I'm testing now with a server returning 50KB of uncompressed text/plain data but Apigee does not compress it. I haven't found docs or config files for this. My user-agent I'm using to test this is sending "Accept-Encoding: gzip, deflate" (Firefox)
I've been testing on both Edge OPDK 4.15.07.00 and enterprise.apigee.com version 160120
You do not have to configure anything for this to work - check this out - https://community.apigee.com/questions/2027/does-apigee-support-compressionde-compression-with.html
Whats the Transfer-Encoding the backend server is returning? i suspect your backend returning 'chunked' - that could be a reason why you are not observing compression
The back-end isn't using 'chunked' encoding, according to the response headers pulled from an Apigee Trace session:
Accept-Ranges: bytes Connection: keep-alive Content-Length: 63138 Content-Type: text/plain Date: Mon, 22 Feb 2016 19:06:22 GMT ETag: 56cb4def-f6a2 Last-Modified: Mon, 22 Feb 2016 18:05:35 GMT Server: nginx/1.8.0
Hi @Mukundha Madhavan, Could you tell me if the backend is returning 'chunked', how do I compress the data and send it to the client?
In my case backend is returning a large amount of data. I have enabled streaming both on APIGEE Cloud and OPDK, but still the data does not seem to pass.
Yes, you are right - i am observing the same behavior -
I expected gzip to work without doing anything, but it did not - I will report it to support
I think i have a workaround for this,
you can add a 'Content-Encoding: gzip' header to the response, to enable response compression, you can do this with a AssignMessage Policy in the response
<Set> <Headers> <Header name="Content-Encoding">gzip</Header> </Headers> </Set>
Thanks @Mukundha Madhavan
That does gzip responses.
However, it's not generally not sufficient because it always gzips responses, even if the client doesn't have an Accept-Encoding: gzip header. I could add the logic myself to parse that request header but it seems like it should work out of the box.
Right, I agree that it should work oob - I have reported it as a bug to the team.
Is there any follow up to this? I expect this to be on by default but I'm sending the gzip request headers and still getting the full sized transfer.