Modifying location block for specific paths


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 (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:

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

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ