Websocket connection not working

Hello,
I am using a python websocket script that is working fine except when running it in traefik.

This is the docker-compose.yaml

version: "3"
services:
  name:
    image: name
    container_name: name
    restart: always
    networks:
      - traefik-global-proxy
    labels:
      - traefik.enable=true
      - traefik.http.routers.name.rule=Host(`ws.name.com`)
      - traefik.http.services.name.loadbalancer.server.port=8000
      - traefik.http.routers.name.entrypoints=websocket
      - traefik.http.routers.name.middlewares=mywssredirect

networks:
  traefik-global-proxy:
    external: true

this is settings i used for 5 or 6 more services running perfectly. how can i change this?

ps: flutter app is connectiing to ws://ws.name.com

i changed name from the correct domain name. could be because traefik is rejecting connections with ws:// ? when i run docker-compose up is stuck in Attatching to container_name.... could not find why. verbose looks normal.

thank!

What’s the error?

This will use port 80, but you have entrypoints=websocket declared:

What is this:

Share your full Traefik static and dynamic config, and docker-compose.yml if used.

I tried with http entrypoint also. Also changing the connection url to ws://ws.name.com:8000 and nothing.

Ignore the middleware thats just a test i did but also tried with and without it.

This is my full traefik docker compose yaml

version: '3.3'

services:

  traefik:
    image: traefik:v3.0
    ports:
      - 443:443
      - 80:80
      - 8000:8000
    networks:
      - traefik-global-proxy
    volumes:
      - ./letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro
    command:
      - --api.dashboard=true
      - --log.level=INFO
      - --accesslog=true
      - --providers.docker.network=traefik-global-proxy
      - --providers.docker.exposedByDefault=false
      - --entrypoints.web.address=:80
      - --entrypoints.web.http.redirections.entrypoint.to=websecure
      - --entrypoints.web.http.redirections.entrypoint.scheme=https
      - --entrypoints.websecure.address=:443
      - --entrypoints.websecure.asDefault=true
      - --entrypoints.websocket.address=:8000
      - --entrypoints.websecure.http.tls.certresolver=myresolver
      - --certificatesresolvers.myresolver.acme.email=oscarmorant.ferrando@gmail.com
      - --certificatesresolvers.myresolver.acme.tlschallenge=true
      - --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json

    labels:
      - traefik.enable=true
      - traefik.http.routers.mydashboard.rule=Host(`traefik.vscoring.com`)
      - traefik.http.routers.mydashboard.service=api@internal
      - traefik.http.routers.mydashboard.middlewares=myauth
      - traefik.http.middlewares.myauth.basicauth.users=admin:$$



networks:
  traefik-global-proxy:
    name: traefik-global-proxy

thank you

Maybe your browser is not allowing (unencrypted) ws connections on a https page.

Check browser developer tools network tab.

Actually is not a webpage. Is only a websocket that the flutter app is connecting for online in-real-time services

So your app connects via ws: to Python, but not to Traefik?

What does Traefik debug log, access log and dashboard tell you?