gateway icon indicating copy to clipboard operation
gateway copied to clipboard

feat: support host rewriting for dynamic resolver

Open zhaohuabing opened this issue 1 month ago • 2 comments

This PR allows rewriting the host for requests to a dynamic resolver backend using either a header value or a literal. EG will use the specified host for both DNS resolving to get the endpoints and the host header in the forwarded requests.

Implement #7638 Release Note: Yes

zhaohuabing avatar Dec 11 '25 04:12 zhaohuabing

Codecov Report

:x: Patch coverage is 84.96503% with 43 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 72.51%. Comparing base (c1c227b) to head (c8a733a). :warning: Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
internal/xds/translator/dynamic_forward_proxy.go 82.77% 22 Missing and 19 partials :warning:
internal/xds/translator/cluster.go 93.10% 1 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7719      +/-   ##
==========================================
+ Coverage   72.38%   72.51%   +0.13%     
==========================================
  Files         234      235       +1     
  Lines       34562    34821     +259     
==========================================
+ Hits        25016    25252     +236     
- Misses       7756     7765       +9     
- Partials     1790     1804      +14     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Dec 11 '25 07:12 codecov[bot]

overall LGTM. looks like we both worked on the same thing =]. Closing my dupe pr: https://github.com/envoyproxy/gateway/pull/7723.

I think that we should avoid using the default host rewrites in this case, e.g. as explained here: https://github.com/envoyproxy/gateway/pull/7723/files#diff-698fcb61202958faff1d63f1eed4a0a3111a888e3b7370f8f16a32cd96b78349R515

Also, we can try to support "literal" host rewrite, since we already have an API for that through GW-API URLRewrite filter: https://github.com/envoyproxy/gateway/pull/7723/files#diff-4e36661dbe02253cfca3d8a82ca2fad306f6e0743ea87d192a51c781aedcaaadR161

maybe also document behavior change in release notes: https://github.com/envoyproxy/gateway/pull/7723/files#diff-8261eaec1f1079fe46bee37a988c04a7876b25a7c93fdc67db2f918ee5e406fbR7

guydc avatar Dec 11 '25 14:12 guydc