envoyproxy / envoy

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

Does envoy supports configuring upstream application layer protocol? #34845

Closed ikimonogakari closed 1 month ago

ikimonogakari commented 3 months ago

I am currently using Envoy as an HTTP proxy to proxy tcp stream to the upstream.

client [CONNECT] --> Envoy --[TCP stream]--> upstream

Currently, after handling the initial CONNECT request, Envoy just blindly forward the inner stream to the upstream using a TCP connection.

I know there is an option to customize my own transport_socket. But in theory, that only affects the transport layer protocol. What I am trying to do, is to add another application layer protocol, such as HTTP, to wrap the stream being proxied through envoy.

Envoy --[HTTP[TCP stream]]--> upstream

I did some research on the config for Clusters, but had no luck. Can someone instruct me how to achieve such functionality in Envoy?

tyxia commented 3 months ago

Hi @ikimonogakari , have you tried TCP Proxy https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/listeners/listener_filters.html#tcp-proxy-filter

ikimonogakari commented 2 months ago

Please clarify a little bit more? Which usage are your referring to?

  1. In the incoming listener, add tcp_proxy filter.
    1. I don't think this works. The incoming traffic is wrapped under an HTTP CONNECT, we need HCM filter to decode the request. IIUC, HCM and tcp_proxy filter cannot exist at the same listener filter chain.
  2. In the incoming listener, points to a cluster which points to an internal listener.
    1. In the internal listener, add tcp_proxy filter.
    2. I also cannot figure out how this can work to add a new HTTP wrapper using HCM or other filters to the egress TCP stream.
github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 month ago

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.