# Websockets endpoint troubleshoot

**URL:** <https://community.traefik.io/t/websockets-endpoint-troubleshoot/13268>\
**Category:** Traefik v1\
**Tags:** docker\
**Created:** [January 31, 2022, 8:58am UTC](https://community.traefik.io/t/websockets-endpoint-troubleshoot/13268 "2022-01-31T08:58:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![damjan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/damjan/32/4874_2.png) [@damjan](https://community.traefik.io/u/damjan)\
**Post date:** [January 31, 2022, 8:58am UTC](https://community.traefik.io/t/websockets-endpoint-troubleshoot/13268/1 "2022-01-31T08:58:39Z")

</div>

Hi, I am using 1.7.12 based docker image and I am trying to configure passing websockets calls using ws/wss endpoint through my Django service.

Most of my config is based on labels in a docker-compose.yml.  
I'd like to add wss endpoint so that I can open something like.  
The ws/s url changes between having secured connection or not.

> ws://{my domain.my tld}/ws/chat/ (this is locally with ip and we don't have use SSL connection.
> 
> wss://{my domain.my tld}/ws/chat/ (this is on the server having SSL)

I tried the following labels:

- "traefik.frontend.entryPoints=https,wss" (should I add ws as well?)
- "traefik.frontend.rule=Host:myhost.mytld; PathPrefix:/" # this one I need for the backend to expose / and api endpoints, I am using Django as the backend service.
- "traefik.frontend.rule=Host:myhost.mytld; PathPrefix: /manage"
- "traefik.frontend.passHostHeader=true"
- "traefik.frontend.redirect.entryPoint=https"

Here is my traefik.toml

> debug = false
> 
> logLevel = "ERROR"  
> defaultEntryPoints = ["https","http","ws","wss"]
> 
> [entryPoints]  
> [entryPoints.http]  
> address = ":80"  
> [entryPoints.http.redirect]  
> entryPoint = "https"  
> [entryPoints.https]  
> address = ":443"  
> [entryPoints.https.tls]
> 
> [backends]  
> [backends.backend-backend1]  
> weight = 20  
> priority = 3
> 
> ```
> [backends.backend-backend2]
> weight = 5
> priority = 2
> 
> [backends.backend-backend3]
> weight = 6
> priority = 6
> url = "wss://myhost.mytld"
> 
> ```

And the Traefik's docker composer service command:

> ```
> image: traefik:1.7.12
> command:
> --api \
> --accessLog.filePath="/logs/access.log" \
> --acme.storage=/acme.json --logLevel=info \
> ${TRAEFIK_ENTRYPOINT_HTTP} ${TRAEFIK_ENTRYPOINT_HTTPS} \
> --defaultentrypoints=${TRAEFIK_DEFAULT_ENTRYPOINTS}
> --acme=${ACME_ENABLE} --acme.entrypoint=https --acme.httpchallenge --acme.httpchallenge.entrypoint=http \
> --acme.domains="${ACME_DOMAINS}" --acme.email="${ACME_EMAIL}" \
> --docker --docker.domain="${DOCKER_DOMAIN}" --docker.endpoint="unix:///var/run/docker.sock" \
> --docker.watch=true --docker.exposedbydefault="true" \
> --file /rules/rules.toml
> 
> ```

.env file content:

> TRAEFIK\_DEFAULT\_ENTRYPOINTS=http  
> TRAEFIK\_ENTRYPOINT\_HTTP=--entryPoints="Name:http Address::80"  
> TRAEFIK\_ENTRYPOINT\_HTTPS=--entryPoints="Name:https Address::443 TLS"

Log errors:

> Undefined entry point(s) 'wss' for frontend frontend-wss-core-mydockerproject-wss

> error creating Frontend Redirect: unknown target entrypoint "https". Skipping frontend frontend-Host-Myhost-mytld-PathPrefix-0...

If you need any more logs or config sections I'll provide them for you.

Thanks.

---

<div class="post-metadata">

**Author:** ![damjan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/damjan/32/4874_2.png) [@damjan](https://community.traefik.io/u/damjan)\
**Post date:** [February 2, 2022, 11:14am UTC](https://community.traefik.io/t/websockets-endpoint-troubleshoot/13268/2 "2022-02-02T11:14:09Z")

</div>

I believe I solved it.

Instead of gunicorn in my backend docker compose service, I switched to:  
`CMD ["daphne", "-p", "8000", "myproj.asgi:application"]`  
as stated in the [Deployment documentation](https://channels.readthedocs.io/en/stable/deploying.html).  
This allows switching from HTTPS to WSS inside the existing service, and doesn't require external intervention like passing headers or path rewrites.

Now, whenever I try to open the endpoint through Traefik, it works with WSS as required.  
E.g:  
`wss://{my domain.my tld}/ws/chat/`  
Tested via external WS testing tool and within the app.

In defaultEntryPoints I removed the "ws","wss" and backends.backend-backend3.

This solution works on both Traefik 1.7 and Trafik 2.6.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [February 5, 2022, 11:14am UTC](https://community.traefik.io/t/websockets-endpoint-troubleshoot/13268/3 "2022-02-05T11:14:45Z")

</div>

Closed on February 5, 2022, 11:14am UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
