On closer inspection of the original author and your curl example, you're after a CONNECT proxy. In plaintext HTTP calls there's no reason to establish CONNECT because the host-header is visible to the proxy to route on. With https, host headers (
google.com) are
not visible to route on due to the nature of TLS encryption of headers+payloads. You'll need to route on SNI or use CONNECT. There's two steps that are occurring with an https vs an http request in your CONNECT curl example:
1. CONNECT is an instruction to open a TCP connection to the upstream server (google).
2. After the CONNECT tunnel (TCP connection) is established, the request is then sent through the TCP connection.
You'll need a filter to terminate the CONNECT at envoy first before sending it to the dynamic forward proxy cluster.
client https request -> CONNECT termination -> dynamic forward proxy