Skip to content

Dynamic Resolver: Support Host Header Rewriting for DNS resolutionΒ #7638

@guydc

Description

@guydc

Description:
Currently, Dynamic Resolver can only forward dynamically to the hostname specified in the HTTP host header.

In some cases, e.g. when an explicit forward proxy is used, the dynamic target may be provided in a different header.

Envoy supports this through the DFP filter's per-route configuration host_rewrite_header option, allowing users to overwrite the host header prior to DNS lookup and Routing (as opposed to other host rewrites, see here: envoyproxy/envoy#8607).

XDS changes

To support this:

dns_cache_config
(extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig) The DNS cache configuration that the filter will attach to. Note this configuration must match that of associated dynamic forward proxy cluster configuration.

API Options

Ideally, we should reuse existing HTTPRouteFilter Host Rewrite API:

type HTTPHostnameModifier struct {
// +kubebuilder:validation:Enum=Header;Backend
// +kubebuilder:validation:Required
Type HTTPHostnameModifierType `json:"type"`
// Header is the name of the header whose value would be used to rewrite the Host header
// +optional
Header *string `json:"header,omitempty"`
}

There are several reuse options:

  1. Infer: When existing Host Rewrite Header option is selected and all BackendRefs are dynamic resolvers: add DFP Filter + Per Route config.
    2.1. The main downsides are: complexity of inferring filters and routes from backend and possibly blocking users that only want to rewrite host for DFP without affecting resolution.
  2. Opt-in: New explicit option, e.g. in BTP DNS section, resolveModifiedHost to enable this functionality
  3. Opt-in: New flag in HTTPURLRewriteFilter, e.g. applyRewriteToDNS

[optional Relevant Links:]

Any extra documentation required to understand the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions