-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support HTTP/1.1 CONNECT for proxied upstreams #3664
Comments
upstream envoy issue, not a gloo one |
documenting config for HTTP request -> envoy (encapsulate in HTTP Connect) -> HTTP Connect-enabled proxy -> upstream. this is useful, for example, if the HTTP Connect enabled proxy is in a DMZ with internet access, but envoy and your other services are not on the internet. put the following envoy config on clipboard: admin:
access_log_path: /tmp/admin_access.log
address:
socket_address:
protocol: TCP
address: 0.0.0.0
port_value: 9903
static_resources:
listeners:
- name: listener_0
address:
# use an in memory pipe here instead, see example in following comment below
socket_address:
protocol: TCP
address: 0.0.0.0
port_value: 10000
filter_chains:
- filters:
- name: tcp
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
stat_prefix: tcp_stats
cluster: "cluster_0"
tunneling_config:
hostname: host.com:443
- name: listener_1
address:
socket_address:
address: 0.0.0.0
port_value: 9999
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: AUTO
stat_prefix: prefix
http_filters:
- name: envoy.filters.http.router
route_config:
name: demo_route
virtual_hosts:
- name: demo_host
domains:
- "*"
routes:
- match:
prefix: "/"
# headers:
# - name: ":method"
# exact_match: GET
route:
cluster: tcp_self_cluster
clusters:
- name: cluster_0
type: LOGICAL_DNS
connect_timeout: 5s
# This ensures HTTP/1.1 CONNECT is used for establishing the tunnel.
typed_extension_protocol_options:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
explicit_http_config:
http_protocol_options: {}
load_assignment:
cluster_name: cluster_0
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
# in this example, this is the address of the proxy in DMZ (supports HTTP Connect)
address: host.docker.internal
port_value: 9876
- name: tcp_self_cluster
connect_timeout: 5.000s
load_assignment:
cluster_name: tcp_self_cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 10000
upstream_connection_options:
tcp_keepalive: {}
type: STATIC and run envoy:
Then start a fake "echo server" as the upstream:
And make an HTTP request:
The flow here is:
Reopening because we need to expose some envoy config to support this flow edit: upon further review, the second cluster and listener aren't necessary for POC. |
If you want to test using SSL: admin:
access_log_path: /tmp/admin_access.log
address:
socket_address:
protocol: TCP
address: 0.0.0.0
port_value: 9903
static_resources:
listeners:
- name: listener_0
address:
pipe:
path: "@/cluster_0"
filter_chains:
- filters:
- name: tcp
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
stat_prefix: tcp_stats
cluster: "cluster_0"
tunneling_config:
hostname: host.com:443
- name: listener_1
address:
socket_address:
address: 0.0.0.0
port_value: 9999
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: AUTO
stat_prefix: prefix
http_filters:
- name: envoy.filters.http.router
route_config:
name: demo_route
virtual_hosts:
- name: demo_host
domains:
- "*"
routes:
- match:
prefix: "/"
route:
cluster: tcp_self_cluster
clusters:
- name: cluster_0
type: LOGICAL_DNS
connect_timeout: 5s
# This ensures HTTP/1.1 CONNECT is used for establishing the tunnel.
typed_extension_protocol_options:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
explicit_http_config:
http_protocol_options: {}
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
'@type': type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
common_tls_context:
tls_certificates:
- certificate_chain:
# base64 encoded
inline_bytes: LS0tLS1CRUdJTiB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2b2Z0b2FlVzQzSEp5dWR6MUFSWWp0N1Uyd3h0dlNHdU9UYlVYMlBPVkhybEoKcDBzWkJzNVFrRHh5V2F2Rno3M1k3bXR2RlFJZWxqd3MwbTByU0pNQ2dZQitMeUM1andrMElNNEpaMXZ2SVFLMApROGExWFNQUUhXVytSNDZpL295QzRFdEN6QmE0M0d2dTh5Q2F3ZFozam5rS2Fuc1hOTko1ZlRDdlhsak1aV0p6CjdEODQvNVZxMWJMTXdLY1ZpamRScFVrMWh3MEdHTFVUZy9sUy9STmJ5Vk16Wm1yaUVoY1NQaGR5a292ZHhmSWQKSE9ub2RhdmthSmw0YmtnSWxyTk1Fdz09Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
load_assignment:
cluster_name: cluster_0
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
# in this example, this is the address of the proxy in DMZ (supports HTTP Connect)
address: host.docker.internal
port_value: 9876
- name: tcp_self_cluster
connect_timeout: 5.000s
load_assignment:
cluster_name: tcp_self_cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
pipe:
path: "@/cluster_0"
upstream_connection_options:
tcp_keepalive: {}
type: STATIC Write this as tls.key file:
Write TLS this as tls.crt file:
Then set up TLS listener
And make requests:
|
In the customer env, the TLS context must go on |
for me above envoy config did not work, but following one does: static_resources:
|
For improved perf, you may use a pipe loopback see https://gist.github.com/cortex93/6d7cd9738b077d0447ab891cbacd0d5e |
i adapted yaml once more time this configuration supports only reaching https url's via forward proxy.
HTTP/1.1 200 Connection established" second: so in gloo case
i assume that this structure would fit gloo virtualservice / upstream via FW proxy paradigm |
Is your feature request related to a problem? Please describe.
I am unable to connect from envoy to an internet upstream through corporate proxy
Describe the solution you'd like
support HTTP/1.1 CONNECT for proxied upstreams
envoyproxy/envoy#11308
The text was updated successfully, but these errors were encountered: