Issue running gateway-bridge in AWS with application load balancer and wss

Viewed 90

I have a gateway bridge running in a docker container in AWS. If I connect a gateway directly to the EC2 node using ws (non-secure websocket) it works fine. I'm trying to now connect via wss (secure websocket) where the secure endpoint is the application loadbalancer which forwards the traffic to my AWS target group containing the same EC2 instance. The gateway bridge EC2 node only gets the non-secure traffic after it is processed by the load balancer.

What appears to be happening is the gateway sends a message to wss:://router-info which gets correctly gets a 101 return code saying it's forwarding the traffic on to the EC2 node. But the gateway-bridge doesn't process the router-info message, it appears like it is expecting the /gateway/<gateway_eui> message because it says it has this log message:

level=error msg="backend/basicstation: parse gateway id error" error="encoding/hex: invalid byte: U+0072 'r'

Looking at the code, it's trying to parse the gateway_eui, but it actually received the /router-info GET.

I believe this is happening because I didn't configure any of the TLS parameters, which I don't want to do since the application load balancer is actually doing the secure TLS termination and not the gateway-bridge.

Is there a way to configure the gateway-bridge to send back some response to the gateway-bridge (like a no-op kind of message) that allows the gateway to continue the connection process? Thanks for any clues on how to proceed.

2 Answers

After a lot of debugging, I finally figured out the issue and it was mainly my nginx configuration plus the fact I was running nginx is a docker container. The forwarded request to the gateway bridge didn't have the correct $host information so that the host info returned in the router-info response was incomplete and or incorrect.

The solution to my issue included enabling the tls_support_proxy as well as fixing my nginx configuration.