envoy icon indicating copy to clipboard operation
envoy copied to clipboard

Add support for matching VirtualHost.Domains without `port` considered

Open howardjohn opened this issue 2 years ago • 0 comments

Title: Add support for matching VirtualHost.Domains without port considered

Description: We would like a way for domains to be matched ignoring port. For example, domains: [foo.com] would match Host: foo.com:1234, if we configured some setting.

Alternatives considered:

  • Set the match to include the port (e.g: domains: [foo.com, foo.com:1234]). The issue with this is we don't know all the ports. The most common case for this is when we have multiple different network paths (example: going through Kubernetes LoadBalancer vs NodePort vs direct, etc) - the set could be unbounded
  • Use strip_port_mode in HCM. This is not viable because it mutates the request; we want to ignore the port in matching but keep it in upstream requests.
  • Use a suffix match (e.g: domains: [foo.com, foo.com:*]). This almost works. The edge case is if we have other prefix matches.

For example:

- domains: [*.example.com:443] # match wildcard
- domains: [foo.example.com, foo.example.com:*] # match concrete

In this case, Host: foo.example.com would correctly match concrete. However, due to precedence rules of wildcards, Host: foo.example.com:443 would end up matching wildcard

howardjohn avatar Aug 11 '22 22:08 howardjohn