Skip to content

hproxy: add HTTP server timeouts and control body limits#1079

Open
marcopeereboom wants to merge 1 commit into
mainfrom
marco/hproxy-dos-hardening
Open

hproxy: add HTTP server timeouts and control body limits#1079
marcopeereboom wants to merge 1 commit into
mainfrom
marco/hproxy-dos-hardening

Conversation

@marcopeereboom

Copy link
Copy Markdown
Contributor

Both the proxy and control HTTP servers had zero timeouts, allowing slowloris-style attacks to hold connections open indefinitely and exhaust file descriptors. The control add and remove endpoints decoded JSON from r.Body without MaxBytesReader, allowing unbounded body reads to cause OOM.

Adds configurable ReadHeaderTimeout, ReadTimeout, WriteTimeout, ServerIdleTimeout, and MaxControlBodySize to the hproxy Config, with defaults and HPROXY_* environment variable wiring in cmd/hproxyd.

Addresses #695.

Both the proxy and control HTTP servers had zero timeouts, allowing
slowloris-style attacks to hold connections open indefinitely and
exhaust file descriptors. Add configurable ReadHeaderTimeout,
ReadTimeout, WriteTimeout, and ServerIdleTimeout to both servers.

The control add and remove endpoints decoded JSON from r.Body without
http.MaxBytesReader, allowing unbounded body reads to cause OOM. Add
a configurable MaxControlBodySize limit (default 1 MiB).

All new values are exposed as HPROXY_* environment variables.
@marcopeereboom marcopeereboom requested a review from a team as a code owner June 16, 2026 14:54
@github-actions github-actions Bot added area: docs This is a change to documentation area: hproxy This is a change to hproxyd changelog: done This pull request includes an appropriate update to CHANGELOG.md. labels Jun 16, 2026
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 45.83333% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/hproxyd/hproxyd.go 0.00% 12 Missing ⚠️
service/hproxy/hproxy.go 91.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs This is a change to documentation area: hproxy This is a change to hproxyd changelog: done This pull request includes an appropriate update to CHANGELOG.md.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant