Host Rewrite
yaml/jsonsettings:host_rewrite,host_rewrite_header,host_path_regex_rewrite_pattern,host_path_regex_rewrite_substitution- Type:
string - Optional
- Example:
host_rewrite: "example.com"
The host header can be preserved via the preserve_host_header setting or customized via three mutually exclusive options:
preserve_host_headerwill, when enabled, this option will pass the host header from the incoming request to the proxied host, instead of the destination hostname. It's an optional parameter of typeboolthat defaults tofalse.See ProxyPreserveHost.
host_rewrite, which will rewrite the host to a new literal value.host_rewrite_header, which will rewrite the host to match an incoming header value.host_path_regex_rewrite_pattern&host_path_regex_rewrite_substitution, which will rewrite the host according to a regex matching the path. For example with the following config:host_path_regex_rewrite_pattern: "^/(.+)/.+$"
host_path_regex_rewrite_substitution: \1Would rewrite the host header to
example.comgiven the path/example.com/some/path.
The 2nd, 3rd and 4th options correspond to the Envoy route action host related options, which can be found here.