From 8ee713f19aaf4eec5972f1ff6d21304de60b1924 Mon Sep 17 00:00:00 2001 From: "data-plane-api(CircleCI)" Date: Wed, 9 May 2018 02:13:55 +0000 Subject: [PATCH] WebSocket: allow configuring idle timeout and reconnects. (#3277) * WebSocket: allow configuring idle timeout and reconnects. This also resolves a TODO in TcpProxy by always passing it a configuration, even in the WebSocket case. Signed-off-by: Greg Greenway Mirrored from https://github.com/envoyproxy/envoy @ c755c0393d8d6fbb16a00c7f2b97b8d0d5478c03 --- envoy/api/v2/route/route.proto | 41 +++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/envoy/api/v2/route/route.proto b/envoy/api/v2/route/route.proto index 7993ba660..caa77eee6 100644 --- a/envoy/api/v2/route/route.proto +++ b/envoy/api/v2/route/route.proto @@ -305,6 +305,7 @@ message CorsPolicy { google.protobuf.BoolValue enabled = 7; } +// [#comment:next free field: 23] message RouteAction { oneof cluster_specifier { option (validate.required) = true; @@ -553,24 +554,48 @@ message RouteAction { // backend). repeated HashPolicy hash_policy = 15; - // Indicates that a HTTP/1.1 client connection to this particular route - // should be allowed (and expected) to upgrade to a WebSocket connection. The - // default is false. + // Indicates that a HTTP/1.1 client connection to this particular route is allowed to + // upgrade to a WebSocket connection. The default is false. // // .. attention:: // - // If set to true, Envoy will expect the first request matching this route to - // contain WebSocket upgrade headers. If the headers are not present, the - // connection will be rejected. If set to true, Envoy will setup plain TCP + // If a connection is upgraded to a WebSocket connection, Envoy will set up plain TCP // proxying between the client and the upstream server. Hence, an upstream // server that rejects the WebSocket upgrade request is also responsible for // closing the associated connection. Until then, Envoy will continue to // proxy data from the client to the upstream server. // - // Redirects, timeouts and retries are not supported on routes where websocket upgrades are - // allowed. + // Redirects are not supported on routes where WebSocket upgrades are allowed. google.protobuf.BoolValue use_websocket = 16; + message WebSocketProxyConfig { + // See :ref:`stat_prefix `. + // If the parameter is not specified, the default value of "websocket" is used. + // + // WebSocket connections support the :ref:`downstream statistics + // ` for TCP proxy, except for the following, which are reported + // in the :ref:`HTTP Connection Manager statistics `: + // - downstream_cx_tx_bytes_total + // - downstream_cx_tx_bytes_buffered + // - downstream_cx_rx_bytes_total + // - downstream_cx_rx_bytes_buffered + string stat_prefix = 1; + + // See :ref:`idle_timeout `. + // This timeout is only in effect after the WebSocket upgrade request is received by Envoy. It does + // not cover the initial part of the HTTP request. + google.protobuf.Duration idle_timeout = 2 + [(validate.rules).duration.gt = {}, (gogoproto.stdduration) = true]; + + // See :ref:`max_connect_attempts + // `. + google.protobuf.UInt32Value max_connect_attempts = 3 [(validate.rules).uint32.gte = 1]; + } + + // Proxy configuration used for WebSocket connections. If unset, the default values as specified + // in :ref:`TcpProxy ` are used. + WebSocketProxyConfig websocket_config = 22; + // Indicates that the route has a CORS policy. CorsPolicy cors = 17;