Gzip enable in KONG CE 2.0

I am new in the KONG. I am using KONG CE 2.0. I need a gzip enable using KONG as the same Nginx provides.

I added gzip on; in nginx-kong.conf file in the server node. But this value is getting reset when I restart the Kong.

How to enable gzip in Kong CE 2.0? Is it possible to do that using KONG

Any update here?
Is it possible to do gzip enable using Kong CE 2.0?

Please take a look at Nginx directive injection in our docs.

Thanks Harry,
I tried the steps mentioned in the Nginx directive injection doc.


I added below configuration in /etc/kong/kong.conf file
nginx_proxy_gzip = on
nginx_proxy_gzip_comp_level = 5
nginx_proxy_gzip_min_length = 256
nginx_proxy_gzip_proxied = any
nginx_proxy_gzip_vary = on

and then restart kong.
Still I am not getting compressed response.
I checked /usr/local/kong/nginx-kong.conf file.
This file have my configuration setting that I added in kong.conf file.

Please guide me what I am missing in that.

I’m not an Nginx ninja so don’t have much clue of what’s going on here.
@datong.sun Any ideas?

@Vikas_Agarwal I think you are setting the configurations on the wrong context. Those directives doesn’t work on proxy context, the are for: http , server , location , if in location. Ref: ngx_module.

You can set them on Kong by envs:
KONG_NGINX_HTTP_GZIP=“on”
KONG_NGINX_HTTP_COMP_LEVEL=5