[request] GZip outbound compression #7363
Replies: 14 comments
-
nginx natively supports gzip, so this shouldn't be hard to activate. gzip may also be already enabled by default (and properly handling the This shouldn't be a plugin, but a default feature of kong. |
Beta Was this translation helpful? Give feedback.
-
@lucamaraschi thoughts? |
Beta Was this translation helpful? Give feedback.
-
I agree on having it in the core and just a simple "decorator" of an api. But can we fine grain it to location/endpoint level? |
Beta Was this translation helpful? Give feedback.
-
The nginx gzip module has many options for controlling what and how gzip is applied to responses. Personally I only gzip certain mime types and even then you have to think about wether or not gzip is actually worth the reward. For instance gzipping a string like |
Beta Was this translation helpful? Give feedback.
-
@montanaflynn, i also there not much gain gzipping small responses. I'm not sure its best do wrap that in a plugin, it is usually a client decision, if the client support read with gzip it will ask for gzipped content, that is why i don't see much benefit using it for just certain APIs. |
Beta Was this translation helpful? Give feedback.
-
Adding that directive would be a good a idea, but there are a lot more options as well. As I noted in the PR #481 there is also the issue of which mime type to apply gzipping to which would be a necassary option to include in the Personally I would prefer to have this type of functionality be configured through a plugin as there are many available options. Having them in I agree that whatever is chosen Kong should respect the |
Beta Was this translation helpful? Give feedback.
-
The trick with this plugin will be to beat the native nginx gzip performance with an OpenResty module. |
Beta Was this translation helpful? Give feedback.
-
I have a similar issue: when I make a request with the "Accept-Encoding: gzip" header, my answer is empty ... |
Beta Was this translation helpful? Give feedback.
-
We have the same problem as @diwann here. We use kong as a proxy and while the service behind it returns a compressed body correctly, when the response go through kong, the body is discarded. All headers are kept though, so tools like cURL and Postman complain that the Here is the output of cURL:
|
Beta Was this translation helpful? Give feedback.
-
@daddykotex what plugins have you installed? |
Beta Was this translation helpful? Give feedback.
-
We've got TCP logging, JWT. We did quite a bit of debugging to try and have this work via nginx configuration but it broke a lua plugin of which I can't remember the details. I think we also tried to use the transformers plugins. |
Beta Was this translation helpful? Give feedback.
-
In the meantime, to add gzip compression to my requests, I updated the
I don't have any transformation plugins enabled and this seems to be working just fine. Thanks. |
Beta Was this translation helpful? Give feedback.
-
@rca Instead of updating the template itself, you should really consider doing so in your own nginx configuration, by copying your current template as-is (without the Lua part), and starting Kong with it: |
Beta Was this translation helpful? Give feedback.
-
Compressing each (or selected) requests with gzip allows to drastically reduce the amount of bandwidth used over the network.
example: https://segment.com/blog/lifecycle-of-a-mobile-message
Beta Was this translation helpful? Give feedback.
All reactions