Skip to content

Instantly share code, notes, and snippets.

@jrockway
Created February 25, 2020 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrockway/7b93f6641c535e71856fbd0abd11e96b to your computer and use it in GitHub Desktop.
Save jrockway/7b93f6641c535e71856fbd0abd11e96b to your computer and use it in GitHub Desktop.
Envoy debugging from Slack

Looks like there was a problem with a react app's reloading websocket thingie. So I decided to test.

Here is a random react app that I decied to try: https://github.com/ahfarmer/calculator

$ npm start

Without an upgrade config:

[2020-02-25 01:13:26.243][4407][debug][http] [source/common/http/conn_manager_impl.cc:731] [C8][S17729359102081406356] request headers complete (end_stream=false): ':authority', '192.168.1.59:3001' ':path', '/sockjs-node' ':method', 'GET' 'connection', 'Upgrade' 'pragma', 'no-cache' 'cache-control', 'no-cache' 'user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36' 'upgrade', 'websocket' 'origin', 'http://192.168.1.59:3001' 'sec-websocket-version', '13' 'accept-encoding', 'gzip, deflate' 'accept-language', 'en-US,en;q=0.9,ja;q=0.8,ca;q=0.7' 'sec-websocket-key', 'dXI0yvA/2pOHXIh5ZBqgfQ==' 'sec-websocket-extensions', 'permessage-deflate; client_max_window_bits'

[2020-02-25 01:13:26.243][4407][debug][http] [source/common/http/conn_manager_impl.cc:1417] [C8][S17729359102081406356] Sending local reply with details upgrade_failed [2020-02-25 01:13:26.243][4407][debug][http] [source/common/http/conn_manager_impl.cc:1615] [C8][S17729359102081406356] encoding headers via codec (end_stream=true): ':status', '403' 'date', 'Tue, 25 Feb 2020 06:13:26 GMT' 'server', 'envoy' 'connection', 'close'

With only the upgrade config... it works fine.

static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 3001
filter_chains:
- filters:
- name: envoy.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
codec_type: auto
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: backend
domains:
- "*"
routes:
- match:
prefix: "/"
route:
cluster: frontend
upgrade_configs:
- upgrade_type: websocket
enabled: true
http_filters:
- name: envoy.router
typed_config: {}
clusters:
- name: frontend
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
#http2_protocol_options: {}
dns_lookup_family: V4_ONLY # new
load_assignment:
cluster_name: frontend
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: localhost
port_value: 3000
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 9901
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment