xbvr icon indicating copy to clipboard operation
xbvr copied to clipboard

WebSocket Problem

Open overloadedStasher opened this issue 4 years ago • 3 comments

I'm using the app with a custom domain in Docker, like other services 10+ I use. It's the first time i get this error, so I wonder if it might be a configuration on the xbvr app:

I can reach it fine using the local ip address and port 9998, but if I try using the domain, I get this error : Bad Request websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header

When looking at the logs, this is what it says : time="2020-11-12T19:10:05-05:00" level=info msg="Error upgrading to websocket connection: websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header" 2020/11/12 19:10:05 http: superfluous response.WriteHeader call from github.com/gammazero/nexus/v3/router.(*WebsocketServer).ServeHTTP (websocketserver.go:327)

overloadedStasher avatar Nov 13 '20 00:11 overloadedStasher

This is expected error to see when you're accessing websocket port directly

Does web UI works on port 9999?

cld9x avatar Dec 02 '20 19:12 cld9x

Kinda yes...

I'm using docker-compose to start the service, and mapped the host port 9998 to the xbvr service port 9999 like this : ports: - "9998:9999" Then, in my reverse proxy, I mapped the xbvr subdomain (xbvr.example.com) to the xbvr service with port 9998.

I've been doing this way with multiple services, whit out problem... Is there another port I should open for the service?

overloadedStasher avatar Dec 03 '20 00:12 overloadedStasher

Traefik detects port 9998 as the service URL/Port, as it chooses the first port in the Dockerfile (which specifies EXPOSE 9998-9999). You can verify this by looking at the Traefik dashboard.

Per pkg/common/common.go, this is specified as a websocket port WsAddr = "0.0.0.0:9998".

Per the Traefik docs, "By default, Traefik uses the first exposed port of a container. Setting the label traefik.http.services.xxx.loadbalancer.server.port overrides that behavior."

Manually set the server port and you'll find it working

    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.xbvr.rule=Host(`xbvr.yourdomain.dom`)"
      - traefik.http.services.xbvr.loadbalancer.server.port=9999
      - "traefik.http.routers.xbvr.tls=true"

michaelkrieger avatar Mar 17 '22 20:03 michaelkrieger