TransWikia.com

Allow Websocket connections on Google Cloud Platform

Server Fault Asked by Nils Eijk on January 2, 2021

We have a GCE project, with several servers behind a loadbalancer. The servers are running a NodeJS HTTPS server. We have recently tried to implement websocket support, but can’t seem to connect to it from behind the loadbalancer. As soon as the upgrade header gets sent to the server to initiate the websocket, it closes the connection with a 400 error.

In the loadbalancer’s logs we see the following:

  @type:  "type.googleapis.com/google.cloud.loadbalancing.type.LoadBalancerLogEntry"   
  statusDetails:  "upgrade_header_rejected"   

The connection doesn’t seem to go through to our backend servers. Does anyone know how to solve this?

One Answer

WebSocket is natively supported by the HTTP(s) load balancers in GCP. If you are using that load balancer and you are receiving the “upgrade_header_rejected” message is probably because the backend rejected the connection. It is also possible that the client tried to upgrade from a secure connection to an insecure one or that the header is an invalid one.

Answered by Marco on January 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP