api: add maxRequestHeaderBytes and host normalization to ClientTrafficPolicy#8825
api: add maxRequestHeaderBytes and host normalization to ClientTrafficPolicy#8825albsga4 wants to merge 7 commits intoenvoyproxy:mainfrom
Conversation
…cPolicy Add maxRequestHeaderBytes to ClientTrafficPolicy.headers for configuring maximum request header size (Envoy max_request_headers_kb). Values use resource.Quantity format (e.g. 80Ki) and are validated to be at least 1Ki. Add host.stripPortMode to ClientTrafficPolicy for stripping ports from the Host/Authority header before route matching. Supports Any (unconditional) and Matching (only when port matches listener port). Fixes envoyproxy#5368 Signed-off-by: asalvador <asalvador@newrelic.com>
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0174fe5350
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Guard against uint32 overflow by rejecting values where bytes/1024 exceeds math.MaxUint32. Signed-off-by: asalvador <asalvador@newrelic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52c7f869ce
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Run docs-api-gen to include HostSettings, StripPortMode, and MaxRequestHeaderBytes in the generated API reference. Signed-off-by: asalvador <asalvador@newrelic.com>
Add stripTrailingHostDot bool to the host section. Maps to Envoy's strip_trailing_host_dot on the HCM. Without this, requests with Host "example.com." don't match routes for "example.com". Fixes envoyproxy#8832 Signed-off-by: asalvador <asalvador@newrelic.com>
Signed-off-by: asalvador <asalvador@newrelic.com>
Signed-off-by: asalvador <asalvador@newrelic.com>
…t/ctp-max-request-headers-strip-port
What type of PR is this?
api: addmaxRequestHeaderBytesandhost.stripPortModefields toClientTrafficPolicyWhat this PR does / why we need it:
Two common
HttpConnectionManagersettings currently requireEnvoyPatchPolicywith fragile jsonPath expressions to configure:max_request_headers_kb— the default 60 KiB limit is too small for many production use cases (large Authorization headers, cookies, etc.)strip_port_mode— clients sendingHost: example.com:443don't match routes defined without portsThis PR adds native
ClientTrafficPolicyfields for both:headers.maxRequestHeaderBytes(resource.Quantity)max_request_headers_kbon the HCM80Ki,100Ki,1Mi, or raw bytes like81920)1Ki(1024 bytes) — values below return an errorconnection.socketBufferLimit(Quantity in API, uint32 in IR)host.stripPortMode(Enum: Any | Matching)hostsection parallel to the existingpathsection (path normalizes path, host normalizes host)Anymaps to Envoystrip_any_host_port(strips port unconditionally)Matchingmaps to Envoystrip_matching_host_port(strips only when port matches listener)Changes:
api/v1alpha1/clienttrafficpolicy_types.go—MaxRequestHeaderBytesinHeaderSettings, newHostSettingsstruct withStripPortModeenuminternal/ir/xds.go—MaxRequestHeadersKB *uint32inHeaderSettings,HostSettingswith typedStripPortMode+ constantsinternal/gatewayapi/clienttrafficpolicy.go— Quantity-to-uint32 conversion with validation,translateHostSettingsinternal/xds/translator/listener.go— xDS translation (typed-nil safe pattern forstrip_port_modeoneof, standalone bool forstrip_matching_host_port)request-header-size.md+host-port-stripping.mdWhich issue(s) this PR fixes:
Fixes #5368
Release Notes: Yes
/cc @arkodg