Limit API request body size (#4757)

Bound the size of HTTP request bodies on the main API listener so large
messages cannot exhaust memory. Configurable via limit.max_api_request_body_size
(defaults to 10 MiB, 0 disables).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Raja Subramanian
2026-08-14 10:36:40 +05:30
committed by GitHub
co-authored by Claude Opus 4.8
parent cc6551d617
commit f72254ba6b
5 changed files with 186 additions and 4 deletions
+2
View File
@@ -111,6 +111,8 @@ func NewLivekitServer(conf *config.Config,
MaxAge: 86400,
}),
negroni.HandlerFunc(RemoveDoubleSlashes),
// limit request body size so large messages cannot exhaust memory
NewRequestBodyLimiter(conf.Limit.MaxAPIRequestBodySize),
}
if keyProvider != nil {
middlewares = append(middlewares, NewAPIKeyAuthMiddleware(keyProvider))