How do I limit file uploads to a maximum size?

Caddy allows you to limit file uploads to a maximum size to prevent abuse.

Written by Chris Oliver
Updated over a week ago
Caddy provides a route handler called "request_body" that you can add to your application's Caddy routes.

For example, this will limit to 1MB:
{
	"handler": "request_body",
	"max_size": 1000000 
}
See the request_body Caddy docs for more details.

Was this article helpful?