Running my Golang app using gorilla websockets in AWS ECS using Fargate and an ALB in front. A couple days ago connecting to the socket was working and then would intermittently fail. Now it is consistently failing to open the socket.
I've tried connecting through the ALB with and without the port as well as connecting to the public ip the ECS Task is running on.
The error my app is logging: websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header
Headers that my app receives, the connection header is somehow missing by the time my app handles the request
{
"Sec-Websocket-Extensions": [
"permessage-deflate; client_max_window_bits"
],
"Sec-Websocket-Key": [
"Dlb3vf23t9rtkY+wwazr7w=="
],
"Sec-Websocket-Version": [
"13"
],
"Via": [
"1.1 ::ffff:172.20.32.1 (Mikrotik HttpProxy)"
],
"X-Forwarded-Port": [
"80"
],
"X-Forwarded-Proto": [
"http"
],
"X-Proxy-Id": [
"619378727"
]
}
Ways I've tried to connect:
wscat -nc ws://www.example.com/v1/ws
wscat -nc ws://www.example.com:80/v1/ws
wscat -nc ws://<public ip>/v1/ws
wscat -nc ws://<public ip>:80/v1/ws
Hi Sanju,
Thanks for providing these links. However, I am not using nginx and only have the ALB pointing directly to the ECS cluster and was wondering if I could get this working without needing to setup nginx behind the ALB since hitting the public IP of the ECS instance already has the headers missing. Is there a way to preserve or add a header on ECS?
Thanks
Hi I am hitting similar problem and I am using Gorilla as webframework to deploy an app on ECS containers. I am getting 404 and I am kinda stuck and not able to move forward. I have not set up any NGINX config for this. Based on AWS documentation,it seems that working with websockets on ALB is no big deal. Was wondering if you were able to sort this problem
I am having the same issue as well with a mattermost server and have configured NGINX to add the headers