Modifying location block for specific paths

Hi,

I am looking to disable “proxy_buffering”, but only for certain paths like “/example”. What’s the path of least resistance for achieving this in Kong? I would like to avoid using a custom NGINX template if possible. I tried using KONG_NGINX_HTTP_INCLUDE, but it seems like that does not allow modifying the Kong proxy server block. Using “nginx_proxy_” seems promising, but it does not seem possible to add new location blocks.

What do you mean by buffering here? could you elaborate?
Kong (by default) doesn’t do anything additional that Nginx for request/response bodies.

Sorry for the confusion, I am referring to this property http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering (i.e. proxy_buffering off;) .

I mainly want to know if it’s possible to modify the Kong Nginx server block to change that property without using a custom Nginx template.

You can’t enable or disable this for select paths. You can try to globally enable it using nginx_proxy_ but I’m not sure what the effects on Kong would be.
@bungle or @datong.sun could elaborate more on this.

You can’t on Kong, but you can on upstream by adding response header:

To make it dynamic on request time, I already proposed this:

We could make similar modification to add also service. response_buffering property to make it dynamic on Kong itself.

You can also inject new location blocks:
KONG_NGINX_PROXY_INCLUDE=my-locations.conf

service.response_buffering would be perfect. We’re currently using the X-Accel-Buffering response header and that’s working great, but we want to try to keep this logic in Kong.

@gmr, ok cool, I updated the proposal here to also have service.response_buffering:

Any feedback welcomed!

1 Like

Would be great to if this is implemented, since there are services in my case which receives large files 5GB>20GB. Would be great if one had the option to disable it on service level instead of disabling it via globally in Nginx.

1 Like