Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 12:15 UTC
admin: Limit config size (by @omercnet)
GitHub was giving me errors related to merge status so we are doing this instead
Matthew Holt committed
Apr 24, 2026 at 11:28 UTC
48c08e3890fe507bb64d59ec8004586ced676171
1 file changed
+3
admin.go
+3
@@ -1063,6 +1063,9 @@ func handleConfig(w http.ResponseWriter, r *http.Request) error {
1063
buf.Reset()
1064
defer bufPool.Put(buf)
1065
1066
+ const maxConfigSize = 100 * 1024 * 1024 // 100 MB
1067
+ r.Body = http.MaxBytesReader(w, r.Body, maxConfigSize)
1068
+
1069
_, err := io.Copy(buf, r.Body)
1070
if err != nil {
1071
return APIError{