Kong Response Size Limiting

Third Party
Related Documentation
Incompatible with
konnect
Third Party: This plugin is developed, tested, and maintained by Optum.

The Kong Response Size Limiting plugin blocks upstream responses with a body size that exceeds a specified limit in megabytes.

When a response exceeds the configured size, the client receives an HTTP 413 status code and the message body: Response size limit exceeded.

Note: This plugin enforces limits based on the Content-Length header in the upstream response.
If the upstream service does not include this header, the plugin cannot enforce the limit and the response will be allowed.

Install the Kong Response Size Limiting plugin

You can install the Kong Response Size Limiting plugin via LuaRocks. A Lua plugin is distributed in .rock format, which is a self-contained package that can be installed locally or from a remote server.

  1. Install the Kong Response Size Limiting plugin:

    luarocks install kong-response-size-limiting
    
  2. Update your loaded plugins list in Kong Gateway.

    In your kong.conf, append kong-response-size-limiting to the plugins field. Make sure the field isn’t commented out.

    plugins = bundled,kong-response-size-limiting
    
  3. Restart Kong Gateway:

    kong restart
    
Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!