Skip to content

Commit c07e5c8

Browse files
authored
connect: docs and cleanup (#11146)
Un-hiding CONNECT docs and config, now that it is implemented. Risk Level: low (docs only) Testing: in prior PRs Docs Changes: yes Release Notes: yes Fixes #1630 and #1451 Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
1 parent 593d32b commit c07e5c8

File tree

14 files changed

+65
-67
lines changed

14 files changed

+65
-67
lines changed

api/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ message HttpConnectionManager {
232232
// Determines if upgrades are enabled or disabled by default. Defaults to true.
233233
// This can be overridden on a per-route basis with :ref:`cluster
234234
// <envoy_api_field_route.RouteAction.upgrade_configs>` as documented in the
235-
// :ref:`upgrade documentation <arch_overview_websocket>`.
235+
// :ref:`upgrade documentation <arch_overview_upgrades>`.
236236
google.protobuf.BoolValue enabled = 3;
237237
}
238238

api/envoy/config/route/v3/route_components.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ message RouteMatch {
393393
google.protobuf.BoolValue validated = 2;
394394
}
395395

396-
// [#not-implemented-hide:]
397396
// An extensible message for matching CONNECT requests.
398397
message ConnectMatcher {
399398
}
@@ -427,14 +426,15 @@ message RouteMatch {
427426
// stripping. This needs more thought.]
428427
type.matcher.v3.RegexMatcher safe_regex = 10 [(validate.rules).message = {required: true}];
429428

430-
// [#not-implemented-hide:]
431429
// If this is used as the matcher, the matcher will only match CONNECT requests.
432430
// Note that this will not match HTTP/2 upgrade-style CONNECT requests
433431
// (WebSocket and the like) as they are normalized in Envoy as HTTP/1.1 style
434432
// upgrades.
435433
// This is the only way to match CONNECT requests for HTTP/1.1. For HTTP/2,
436434
// where CONNECT requests may have a path, the path matchers will work if
437435
// there is a path present.
436+
// Note that CONNECT support is currently considered alpha in Envoy.
437+
// [#comment:TODO(htuch): Replace the above comment with an alpha tag.
438438
ConnectMatcher connect_matcher = 12;
439439
}
440440

@@ -721,7 +721,6 @@ message RouteAction {
721721
option (udpa.annotations.versioning).previous_message_type =
722722
"envoy.api.v2.route.RouteAction.UpgradeConfig";
723723

724-
// [#not-implemented-hide:]
725724
// Configuration for sending data upstream as a raw data payload. This is used for
726725
// CONNECT requests, when forwarding CONNECT payload as raw TCP.
727726
message ConnectConfig {
@@ -738,9 +737,10 @@ message RouteAction {
738737
// Determines if upgrades are available on this route. Defaults to true.
739738
google.protobuf.BoolValue enabled = 2;
740739

741-
// [#not-implemented-hide:]
742740
// Configuration for sending data upstream as a raw data payload. This is used for
743741
// CONNECT requests, when forwarding CONNECT payload as raw TCP.
742+
// Note that CONNECT support is currently considered alpha in Envoy.
743+
// [#comment:TODO(htuch): Replace the above comment with an alpha tag.
744744
ConnectConfig connect_config = 3;
745745
}
746746

api/envoy/config/route/v4alpha/route_components.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ message RouteMatch {
394394
google.protobuf.BoolValue validated = 2;
395395
}
396396

397-
// [#not-implemented-hide:]
398397
// An extensible message for matching CONNECT requests.
399398
message ConnectMatcher {
400399
option (udpa.annotations.versioning).previous_message_type =
@@ -430,14 +429,15 @@ message RouteMatch {
430429
// stripping. This needs more thought.]
431430
type.matcher.v4alpha.RegexMatcher safe_regex = 10 [(validate.rules).message = {required: true}];
432431

433-
// [#not-implemented-hide:]
434432
// If this is used as the matcher, the matcher will only match CONNECT requests.
435433
// Note that this will not match HTTP/2 upgrade-style CONNECT requests
436434
// (WebSocket and the like) as they are normalized in Envoy as HTTP/1.1 style
437435
// upgrades.
438436
// This is the only way to match CONNECT requests for HTTP/1.1. For HTTP/2,
439437
// where CONNECT requests may have a path, the path matchers will work if
440438
// there is a path present.
439+
// Note that CONNECT support is currently considered alpha in Envoy.
440+
// [#comment:TODO(htuch): Replace the above comment with an alpha tag.
441441
ConnectMatcher connect_matcher = 12;
442442
}
443443

@@ -724,7 +724,6 @@ message RouteAction {
724724
option (udpa.annotations.versioning).previous_message_type =
725725
"envoy.config.route.v3.RouteAction.UpgradeConfig";
726726

727-
// [#not-implemented-hide:]
728727
// Configuration for sending data upstream as a raw data payload. This is used for
729728
// CONNECT requests, when forwarding CONNECT payload as raw TCP.
730729
message ConnectConfig {
@@ -744,9 +743,10 @@ message RouteAction {
744743
// Determines if upgrades are available on this route. Defaults to true.
745744
google.protobuf.BoolValue enabled = 2;
746745

747-
// [#not-implemented-hide:]
748746
// Configuration for sending data upstream as a raw data payload. This is used for
749747
// CONNECT requests, when forwarding CONNECT payload as raw TCP.
748+
// Note that CONNECT support is currently considered alpha in Envoy.
749+
// [#comment:TODO(htuch): Replace the above comment with an alpha tag.
750750
ConnectConfig connect_config = 3;
751751
}
752752

api/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ message HttpConnectionManager {
231231
// Determines if upgrades are enabled or disabled by default. Defaults to true.
232232
// This can be overridden on a per-route basis with :ref:`cluster
233233
// <envoy_api_field_config.route.v3.RouteAction.upgrade_configs>` as documented in the
234-
// :ref:`upgrade documentation <arch_overview_websocket>`.
234+
// :ref:`upgrade documentation <arch_overview_upgrades>`.
235235
google.protobuf.BoolValue enabled = 3;
236236
}
237237

api/envoy/extensions/filters/network/http_connection_manager/v4alpha/http_connection_manager.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ message HttpConnectionManager {
231231
// Determines if upgrades are enabled or disabled by default. Defaults to true.
232232
// This can be overridden on a per-route basis with :ref:`cluster
233233
// <envoy_api_field_config.route.v4alpha.RouteAction.upgrade_configs>` as documented in the
234-
// :ref:`upgrade documentation <arch_overview_websocket>`.
234+
// :ref:`upgrade documentation <arch_overview_upgrades>`.
235235
google.protobuf.BoolValue enabled = 3;
236236
}
237237

docs/root/intro/arch_overview/http/upgrades.rst

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _arch_overview_websocket:
1+
.. _arch_overview_upgrades:
22

33
HTTP upgrades
44
===========================
@@ -62,44 +62,43 @@ a GET method on the final Envoy-Upstream hop.
6262
Note that the HTTP/2 upgrade path has very strict HTTP/1.1 compliance, so will not proxy WebSocket
6363
upgrade requests or responses with bodies.
6464

65-
.. TODO(alyssawilk) unhide this when unhiding config
66-
.. CONNECT support
67-
.. ^^^^^^^^^^^^^^^
68-
69-
.. Envoy CONNECT support is off by default (Envoy will send an internally generated 403 in response to
70-
.. CONNECT requests). CONNECT support can be enabled via the upgrade options described above, setting
71-
.. the upgrade value to the special keyword "CONNECT".
72-
73-
.. While for HTTP/2, CONNECT request may have a path, in general and for HTTP/1.1 CONNECT requests do
74-
.. not have a path, and can only be matched using a
75-
.. :ref:`connect_matcher <envoy_api_field_route.RouteMatch.connect_matcher>`
76-
..
77-
.. Envoy can handle CONNECT in one of two ways, either proxying the CONNECT headers through as if they
78-
.. were any other request, and letting the upstream terminate the CONNECT request, or by terminating the
79-
.. CONNECT request, and forwarding the payload as raw TCP data. When CONNECT upgrade configuration is
80-
.. set up, the default behavior is to proxy the CONNECT request, treating it like any other request using
81-
.. the upgrade path.
82-
.. If termination is desired, this can be accomplished by setting
83-
.. :ref:`connect_config <envoy_api_field_config.filter.network.http_connection_manager.v2.HttpConnectionManager.UpgradeConfig.connect_config>`
84-
.. If it that message is present for CONNECT requests, the router filter will strip the request headers,
85-
.. and forward the HTTP payload upstream. On receipt of initial TCP data from upstream, the router
86-
.. will synthesize 200 response headers, and then forward the TCP data as the HTTP response body.
87-
88-
.. .. warning::
89-
.. This mode of CONNECT support can create major security holes if configured correctly, as the upstream
90-
.. will be forwarded *unsanitized* headers if they are in the body payload. Please use with caution
91-
92-
.. Tunneling TCP over HTTP/2
93-
.. ^^^^^^^^^^^^^^^^^^^^^^^^^
94-
.. Envoy also has support for transforming raw TCP into HTTP/2 CONNECT requests. This can be used to
95-
.. proxy multiplexed TCP over pre-warmed secure connections and amortize the cost of any TLS handshake.
96-
.. An example set up proxying SMTP would look something like this
97-
..
98-
.. [SMTP Upstream] --- raw SMTP --- [L2 Envoy] --- SMTP tunneled over HTTP/2 --- [L1 Envoy] --- raw SMTP --- [Client]
99-
..
100-
.. Examples of such a set up can be found in the Envoy example config `directory <https://github.com/envoyproxy/envoy/tree/master/configs/>`
101-
.. If you run `bazel-bin/source/exe/envoy-static --config-path configs/encapsulate_in_connect.yaml --base-id 1`
102-
.. and `bazel-bin/source/exe/envoy-static --config-path configs/terminate_connect.yaml`
103-
.. you will be running two Envoys, the first listening for TCP traffic on port 10000 and encapsulating it in an HTTP/2
104-
.. CONNECT request, and the second listening for HTTP/2 on 10001, stripping the CONNECT headers, and forwarding the
105-
.. original TCP upstream, in this case to google.com.
65+
CONNECT support
66+
^^^^^^^^^^^^^^^
67+
68+
Envoy CONNECT support is off by default (Envoy will send an internally generated 403 in response to
69+
CONNECT requests). CONNECT support can be enabled via the upgrade options described above, setting
70+
the upgrade value to the special keyword "CONNECT".
71+
72+
While for HTTP/2, CONNECT request may have a path, in general and for HTTP/1.1 CONNECT requests do
73+
not have a path, and can only be matched using a
74+
:ref:`connect_matcher <envoy_v3_api_msg_config.route.v3.RouteMatch.ConnectMatcher>`
75+
76+
Envoy can handle CONNECT in one of two ways, either proxying the CONNECT headers through as if they
77+
were any other request, and letting the upstream terminate the CONNECT request, or by terminating the
78+
CONNECT request, and forwarding the payload as raw TCP data. When CONNECT upgrade configuration is
79+
set up, the default behavior is to proxy the CONNECT request, treating it like any other request using
80+
the upgrade path.
81+
If termination is desired, this can be accomplished by setting
82+
:ref:`connect_config <envoy_v3_api_field_config.route.v3.RouteAction.UpgradeConfig.connect_config>`
83+
If it that message is present for CONNECT requests, the router filter will strip the request headers,
84+
and forward the HTTP payload upstream. On receipt of initial TCP data from upstream, the router
85+
will synthesize 200 response headers, and then forward the TCP data as the HTTP response body.
86+
87+
.. warning::
88+
This mode of CONNECT support can create major security holes if configured correctly, as the upstream
89+
will be forwarded *unsanitized* headers if they are in the body payload. Please use with caution
90+
91+
Tunneling TCP over HTTP/2
92+
^^^^^^^^^^^^^^^^^^^^^^^^^
93+
Envoy also has support for transforming raw TCP into HTTP/2 CONNECT requests. This can be used to
94+
proxy multiplexed TCP over pre-warmed secure connections and amortize the cost of any TLS handshake.
95+
An example set up proxying SMTP would look something like this
96+
97+
[SMTP Upstream] --- raw SMTP --- [L2 Envoy] --- SMTP tunneled over HTTP/2 --- [L1 Envoy] --- raw SMTP --- [Client]
98+
99+
Examples of such a set up can be found in the Envoy example config :repo:`directory <configs/>`
100+
If you run `bazel-bin/source/exe/envoy-static --config-path configs/encapsulate_in_connect.yaml --base-id 1`
101+
and `bazel-bin/source/exe/envoy-static --config-path configs/terminate_connect.yaml`
102+
you will be running two Envoys, the first listening for TCP traffic on port 10000 and encapsulating it in an HTTP/2
103+
CONNECT request, and the second listening for HTTP/2 on 10001, stripping the CONNECT headers, and forwarding the
104+
original TCP upstream, in this case to google.com.

docs/root/version_history/current.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Changes
2323
* gzip filter: added option to set zlib's next output buffer size.
2424
* health checks: allow configuring health check transport sockets by specifying :ref:`transport socket match criteria <envoy_v3_api_field_config.core.v3.HealthCheck.transport_socket_match_criteria>`.
2525
* http: added :ref:`stripping port from host header <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.strip_matching_host_port>` support.
26+
* http: added support for proxying CONNECT requests, terminating CONNECT requests, and converting raw TCP streams into HTTP/2 CONNECT requests. See :ref:`upgrade documentation<arch_overview_upgrades>` for details.
2627
* http: fixed a bug where in some cases slash was moved from path to query string when :ref:`merging of adjacent slashes<envoy_api_field_config.filter.network.http_connection_manager.v2.HttpConnectionManager.merge_slashes>` is enabled.
2728
* http: fixed several bugs with applying correct connection close behavior across the http connection manager, health checker, and connection pool. This behavior may be temporarily reverted by setting runtime feature `envoy.reloadable_features.fix_connection_close` to false.
2829
* http: fixed a bug where the upgrade header was not cleared on responses to non-upgrade requests.

docs/root/version_history/v1.4.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Changes
1414
* Hot restart :repo:`compile time flag </bazel#hot-restart>` added.
1515
* Original destination :ref:`cluster <arch_overview_service_discovery_types_original_destination>`
1616
and :ref:`load balancer <arch_overview_load_balancing_types_original_destination>` added.
17-
* :ref:`WebSocket <arch_overview_websocket>` is now supported.
17+
* :ref:`WebSocket <arch_overview_upgrades>` is now supported.
1818
* Virtual cluster priorities have been hard removed without deprecation as we are reasonably sure
1919
no one is using this feature.
2020
* Route `validate_clusters` option added.

generated_api_shadow/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.proto

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated_api_shadow/envoy/config/route/v3/route_components.proto

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)