envoyproxy / envoy

Cloud-native high-performance edge/middle/service proxy
https://www.envoyproxy.io
Apache License 2.0
25.05k stars 4.82k forks source link

Custom headers are not available to the SNI `override_auto_sni_header` when added using `request_headers_to_add` #18308

Open agrawroh opened 3 years ago

agrawroh commented 3 years ago

Title

Custom headers are not available to the SNI override_auto_sni_header when added using request_headers_to_add

Description

We now allow a customer header to populate the SNI for the upstream requests [Link]. But, if the custom header is not coming from downstream and gets added anywhere using request_headers_to_add then it's value is not available here as this piece of code to populate the SNI gets invoked before we add/modify the request headers probably here.

agrawroh commented 3 years ago

@ggreenway @lizan Is it possible to populate the SNI after we do all the mutations on the incoming headers?

mattklein123 commented 3 years ago

Yeah seems like we could probably reorder this.

gabrielgiussi commented 1 year ago

I'm having a similar issue with host_rewrite_literal and dns resolution using a dynamic forward proxy, it fails dns resolution because it is using the original host header instead of the value specified in host_rewrite_literal.