Without it, an upload of any size is read and proxied. The plugin checks Content-Length up front and stops the request at the gateway rather than at your service.
curl -X POST http://localhost:8001/routes/api/plugins \
--data name=request-size-limiting \
--data config.allowed_payload_size=8 \
--data config.size_unit=megabytes \
--data config.require_content_length=false
curl -X POST localhost:8000/api --data-binary @20mb.bin
HTTP/1.1 413 Request Entity Too Large
{"message":"Request size limit exceeded"}
# require_content_length=true rejects chunked uploads that do not declare a
# size. Safer, and it breaks streaming clients - decide which you have.
#
# nginx has its own ceiling underneath this:
# nginx_http_client_max_body_size = 8m
# whichever is smaller wins, and the nginx one returns a plain HTML 413.
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-08-25