Implement body size limit middleware with dynamic config reload

Add body_limit middleware that reads limit from ArcSwap<DynamicConfig>
on each request, enabling runtime config changes without restart.
Uses Content-Length header check for fast rejection and http_body_util::Limited
for streaming body enforcement. Default limit: 100 MB (104,857,600 bytes).
Returns 413 Payload Too Large when exceeded.
This commit is contained in:
glm-5.1 committed 2026-06-11 13:02:59 +00:00
1 parent 994ce0fb66
commit 5fa0fc600e
5 files changed
+285

No files matched your search

Generated
+1
View File
@@ -1585,6 +1585,7 @@ dependencies = [
"axum",
"clap",
"futures",
"http-body-util",
"hyper",
"rcgen",
"reqwest",