oauth2-proxy/pkg
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
..
apis feat(upstream): add configurable transport buffer sizes for large uploads 2026-03-29 05:48:01 -04:00
app chore(lint): fix staticcheck issues (#3061) 2025-05-26 12:29:34 +02:00
authentication fix: hmacauth dependency licensing issue (#3253) 2025-11-09 20:14:54 +01:00
cookies feat: add same site option for csrf cookies (#3347) 2026-03-18 23:14:36 +08:00
encryption fix alpha config 2025-11-16 22:38:40 +01:00
header revert: secrets as []byte instead of string 2025-11-16 22:38:42 +01:00
ip fix: handle Unix socket RemoteAddr in IP resolution (#3374) 2026-03-23 10:22:36 +01:00
logger Request ID Logging (#1087) 2021-03-21 18:20:57 +00:00
middleware fix: improve logging when session refresh token is missing (#3327) 2026-03-23 10:54:32 +01:00
providers feat: add support for specifying allowed OIDC JWT signing algorithms (#2753) (#2851) 2026-03-18 22:24:27 +08:00
proxyhttp feat: add support for setting a unix binding's socket file mode (#3376) 2026-03-19 00:08:50 +08:00
requests use official upstream yaml library v3 2025-11-16 22:38:22 +01:00
sessions feat: add same site option for csrf cookies (#3347) 2026-03-18 23:14:36 +08:00
upstream feat(upstream): add configurable transport buffer sizes for large uploads 2026-03-29 05:48:01 -04:00
util feat: allow arbitrary claims from the IDToken and IdentityProvider UserInfo endpoint to be added to the session state (#2685) 2026-03-14 12:04:33 +08:00
validation feat(upstream): add configurable transport buffer sizes for large uploads 2026-03-29 05:48:01 -04:00
version feat: Replace default Go user-agent with oauth2-proxy and version (#2570) 2024-07-14 21:09:17 +01:00
watcher Fix Linting Errors (#1835) 2022-10-21 11:57:51 +01:00