2020-11-19 20:04:39 +01:00
---
title: request_body (Caddyfile directive)
---
# request_body
Manipulates or sets restrictions on the bodies of incoming requests.
## Syntax
```caddy-d
request_body [< matcher > ] {
2024-02-20 06:49:30 -05:00
max_size < value >
2025-04-27 10:29:05 +02:00
set < body_content >
2020-11-19 20:04:39 +01:00
}
```
2024-02-20 06:49:30 -05:00
- **max_size** is the maximum size in bytes allowed for the request body. It accepts all size values supported by [go-humanize ](https://pkg.go.dev/github.com/dustin/go-humanize#pkg-constants ). Reads of more bytes will return an error with HTTP status `413` .
2020-11-19 20:04:39 +01:00
2025-04-27 11:32:18 +02:00
⚠️ < i > Experimental< / i > < span style = 'white-space: pre;' > | < / span > < span > v2.10.0+< / span >
2025-04-27 10:29:05 +02:00
- **set** allows setting the request body to specific content. The content can include placeholders to dynamically insert data.
2020-11-19 20:04:39 +01:00
## Examples
Limit request body sizes to 10 megabytes:
2024-02-20 06:49:30 -05:00
```caddy
example.com {
request_body {
max_size 10MB
}
reverse_proxy localhost:8080
2020-11-19 20:04:39 +01:00
}
```
2025-04-27 10:29:05 +02:00
Set the request body with a JSON structure containing a SQL query:
```caddy
example.com {
handle /jazz {
request_body {
2025-04-27 11:32:18 +02:00
set `\{"statementText":"SELECT name, genre, debut_year FROM artists WHERE genre = 'Jazz'"}`
2025-04-27 10:29:05 +02:00
}
reverse_proxy localhost:8080 {
header_up Content-Type application/json
method POST
rewrite * /execute-sql
}
2025-04-27 11:32:18 +02:00
}
2025-04-27 10:29:05 +02:00
}
```