fix(proxy): add max_header_list_size config for HTTP/2 client#4542
fix(proxy): add max_header_list_size config for HTTP/2 client#4542wahajahmed010 wants to merge 1 commit into
Conversation
Adds client-side configurability for the h2 max header list size, which defaults to 16 KiB in Hyper 1.x and is insufficient for gRPC services with large trailers. Changes: - linkerd/http/h2: Add max_header_list_size to ClientParams struct and include it in override_from method - linkerd/app/env: Add http2::parse_client() for client params parsing and wire it to LINKERD2_PROXY_OUTBOUND_CONNECT_HTTP2_* and LINKERD2_PROXY_INBOUND_CONNECT_HTTP2_* env vars - linkerd/proxy/http: Apply max_header_list_size in h2 Connect::call Env vars (follow server pattern): *_MAX_HEADER_LIST_SIZE *_MAX_FRAME_SIZE *_MAX_SEND_BUF_SIZE *_KEEP_ALIVE_TIMEOUT / *_KEEP_ALIVE_INTERVAL / *_KEEP_ALIVE_WHILE_IDLE Fixes linkerd/linkerd2#15199
|
Thanks for this — the approach looks right, and I was able to validate it locally against the max-header repro (HTTP 22 KiB response headers + gRPC 22 KiB trailers) once the custom proxy was deployed with the new env vars set. While building the branch, I hit a couple of issues that block a clean 1. Missing field in Adding
2. Dead code / unused imports in Switching inbound/outbound connect config to
These fail the build with 3. (Optional) Behavior change to call out Previously, connect flow-control window sizes were driven by the global env vars: After this change, connect-side settings only come from the prefixed vars: If anyone was relying on the global vars for connect tuning, that would silently stop working. Worth documenting in the PR description or preserving backward compatibility. |
|
You can find a repo to test the issue here, with instructions on how to test it with this custom fixed branch: |
|
hi @cratelyn @wahajahmed010 looks like the build is failing for the DCO action.
Can you resolve that please? |
|
@cratelyn |
Summary
After the Hyper 0.14→1.x migration, the HTTP/2 client defaults to
DEFAULT_MAX_HEADER_LIST_SIZE = 16 KiB, which is too restrictive for gRPC services with large trailers. The server side already has env var support formax_header_list_size, but the client side did not.This PR adds client-side configurability via environment variables, following the same pattern already used for server-side h2 params.
Changes
linkerd/http/h2/src/lib.rsmax_header_list_size: Option<u32>toClientParamsstructmax_header_list_sizein theoverride_frommethodlinkerd/app/src/env/http2.rsparse_client()function for client-side h2 params parsing (mirrorsparse_server())linkerd/app/src/env.rsh2::ClientParamsconstruction in outbound/inbound connect configs with calls tohttp2::parse_client()linkerd/proxy/http/src/h2.rsmax_header_list_sizefromClientParamsbuilder.max_header_list_size(sz)in the h2 connection setupEnvironment Variables
Client params use the prefix
LINKERD2_PROXY_OUTBOUND_CONNECT_HTTP2_andLINKERD2_PROXY_INBOUND_CONNECT_HTTP2_:*_MAX_HEADER_LIST_SIZE(e.g.,65536)*_MAX_FRAME_SIZE*_MAX_SEND_BUF_SIZE*_KEEP_ALIVE_TIMEOUT/*_KEEP_ALIVE_INTERVAL/*_KEEP_ALIVE_WHILE_IDLE*_ADAPTIVE_FLOW_CONTROL/*_INITIAL_STREAM_WINDOW_SIZE/*_INITIAL_CONNECTION_WINDOW_SIZEFixes linkerd/linkerd2#15199