oauth2-proxy/pkg/apis/options
Mateen Anjum c2a5dfa4ea
feat(upstream): add configurable transport buffer sizes for large uploads
Large PUT/POST uploads (>60MB) fail with context canceled when an nginx
reverse proxy sits in front of oauth2-proxy. The root cause is that
http.Transport inherits Go's default 4KB WriteBufferSize, requiring
~15,000 write syscalls for a 60MB upload. This generates backpressure
on the nginx->oauth2-proxy pipe. Once nginx hits proxy_read_timeout
between consecutive write ops, it closes the connection, canceling
req.Context(), which propagates as context canceled on the in-flight
RoundTrip to the upstream.

Expose writeBufferSize and readBufferSize on the Upstream config struct,
wired to transport.WriteBufferSize and transport.ReadBufferSize in
newReverseProxy. Both default to 0 (preserving current behavior, Go
uses 4KB). Setting writeBufferSize to 65536 (64KB) reduces write
syscalls by 16x and resolves the timeout correlation for large uploads.

Fixes #3389

Signed-off-by: Mateen Anjum <mateenali66@gmail.com>
2026-03-29 05:48:01 -04:00
..
testutil chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00
util revert: secrets as []byte instead of string 2025-11-16 22:38:42 +01:00
alpha_options.go feat: add ensure defaults to all migrated structs 2025-11-16 22:38:52 +01:00
app.go Allow specifying URL as input for custom sign in logo (#1330) 2021-09-05 09:23:22 -07:00
cookie.go feat: add same site option for csrf cookies (#3347) 2026-03-18 23:14:36 +08:00
cookie_test.go feat(cookie): add feature support for cookie-secret-file (#3104) 2025-07-22 18:59:55 +02:00
doc.go fix alpha config 2025-11-16 22:38:40 +01:00
header.go feat: migrate google used organization id and header normalization booleans to pointers 2025-11-16 22:39:01 +01:00
hooks.go fix merge problems and test cases 2025-11-16 22:38:44 +01:00
hooks_test.go fix merge problems and test cases 2025-11-16 22:38:44 +01:00
legacy_options.go chore(deps): update gomod and golangci/golangci-lint to v2.11.4 (#3382) 2026-03-23 09:38:12 +01:00
legacy_options_test.go feat: add support for specifying allowed OIDC JWT signing algorithms (#2753) (#2851) 2026-03-18 22:24:27 +08:00
load.go doc: fix mapstructure configuration comments 2025-11-28 17:20:15 +01:00
load_test.go fix merge problems and test cases 2025-11-16 22:38:44 +01:00
logging.go feat: readiness check (#1839) 2022-12-23 09:08:12 +00:00
login_url_parameters.go use official upstream yaml library v3 2025-11-16 22:38:22 +01:00
options.go feat: add ensure defaults to all migrated structs 2025-11-16 22:38:52 +01:00
options_suite_test.go chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00
providers.go feat: add support for specifying allowed OIDC JWT signing algorithms (#2753) (#2851) 2026-03-18 22:24:27 +08:00
secret_source.go feat: add ensure defaults to all migrated structs 2025-11-16 22:38:52 +01:00
server.go feat: add support for setting a unix binding's socket file mode (#3376) 2026-03-19 00:08:50 +08:00
sessions.go Add ability to configure username for Redis cluster connections (#2381) 2024-01-20 20:00:02 +00:00
upstreams.go feat(upstream): add configurable transport buffer sizes for large uploads 2026-03-29 05:48:01 -04:00