Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCP HTTP Load balancer - Websocket getting upgrade but no frames from the client

I just noticed that gcp http(s) load balancer now supports websockets. I went to try it out and am having some problems. I have a gloabl https load balancer setup with Cloud CDN and a simple, no url-map, backend (Node.js). When I go to make websocket connection, I get a successful upgrade response but when I go to send frames to the server, they are never received. The server can send frames back to the client just fine. It is almost like the load balancer doesn't know that the connection has been upgraded and therefore doesn't allow any data sent from the client.

When I look in the logs for the https load balancer, I see the 101 Switching Protocols response and then statusDetails is "client_disconnected_after_partial_response" almost like it was a normal http request.

Any help would be appreciated.

like image 434
Brandon Tuttle Avatar asked May 09 '17 15:05

Brandon Tuttle


People also ask

Does WebSocket go through load balancer?

The load balancer knows how to upgrade an HTTP connection to a WebSocket connection and once that happens, messages will travel back and forth through a WebSocket tunnel. However, you must design your system for scale if you plan to load balance multiple WebSocket servers.

Which technique is used by https load balancer to send the same client traffic to the same backend instance?

External TCP Proxy Load Balancing supports Session Affinity and offers client IP affinity, which forwards all requests from the same client IP address to the same backend.

Is Google Cloud http https internal load balancer receives traffic from Internet?

Internal HTTP(S) Load Balancing distributes HTTP and HTTPS traffic to backends hosted on Compute Engine, Google Kubernetes Engine (GKE), and Cloud Run. The load balancer is accessible only in the chosen region of your Virtual Private Cloud (VPC) network on an internal IP address.

Does cloud run support WebSockets?

WebSockets applications are supported on Cloud Run with no additional configuration required.


1 Answers

After some investigation it seems that when a GCP load balancer is going through the GCP CDN, client messages never make it to the backend.

I worked around this by duplicating the backend configuration I wanted in a new backend called "websocket-prototype," and then just changing the "use cdn" setting for the websocket prototype. Finally, I mapped the path to my websocket server to the configuration without the CDN.

enter image description here

like image 127
Riley Lark Avatar answered Oct 18 '22 22:10

Riley Lark