Hello Guys,
I have a question ? What's the configuration for enable websockets support in specfied backend?
I need configure the wss support in traefik configuration in entrypoints and in this backend I need configure this Flags??
My version the traefik is traefik:v1.7.12-alpine
in my config.toml only have this entrypoint in this moment (entryPoint = "http"
)
I running traefik in ECS
https://docs.traefik.io/v1.7/configuration/backends/ecs/
I don't see annotations about websockets in this documentation
Hi @nightmareze1,
Websockets is supported out of the box by Traefik, without any subsequent configuration.
So you have to define your websocket backend application as if it was pure HTTP, and that's all.
Working example here: https://github.com/containous/slides/blob/online-meetup-201901/demo/docker-compose.yml#L55 .
If you cannot make it work as expected, can you provide us you full configuration?
Hello dduportal!
I review your example but I don't see wss configure in that docker-compose.yml
https://github.com/containous/slides/blob/online-meetup-201901/demo/docker-compose.yml#L55 .
This is my backend configuration:
Hey @nightmareze1,
You did it already with setting the traefik.frontend.entryPoints
label. What error are you facing exactly?
As @dduportal mentioned, please provide a full configuration and your exact error
Yes for a good reason: there is no need to define anything for wss, as it's tunnelled within HTTP.
So you define you WSS application as if it is a normal web application in Traefik and it works.
As @SantoDE told you, we need you to give us more information because we are blind right now.
First of all: what did you try and what is your error?
Also, based on the screenshot you gave earlier, I see a few potential hiccups and questions:
- For the
traefik.frontend.rule
, you can simplify it to Host:api.staging.example.com
, as PathPrefix:/
does not have any meaning.
- You can remove the label
traefik.backend
. Traefik generates dynamic names for backend defined from Docker labels. Let's simplify the configuration to avoid maintaining this and tight down any issue.
- You can remove the label
traefik.wss.protocol
. This defines a "segment" (reference: https://docs.traefik.io/v1.7/configuration/backends/docker/#on-containers-with-multiple-ports-segment-labels) which is not what you want to do here. Also, as the default value of traefik.protocol
is http
, there is no need to specify it again.
- You have to fix the casing of
traefik.frontend.entryPoints
to lower case as specified on https://docs.traefik.io/v1.7/configuration/backends/docker/#on-containers. Also, there is a duplciated value (ws
is there 2 times).
- Can you share the definition of the main Traefik configuration (
traefik.toml
and/or CLI flags provided to Traefik)? How are defined the "entrypoints" named ws
and wss
and on which port? If you are not sure about what are the "entrypoints" in Traefik, you might want to read https://docs.traefik.io/v1.7/configuration/entrypoints/. By default, only the entrypoint named http
(it's just a name) and listening on port 80
is created, unless you specify other entrypoints objects.
=> I would suggest to remove anything unessecary for starting: only use http entrypoint (no https) at all, disable all healtchecks and pattern breaker, and only use your WSS application in plain http to see if it works. Then enable the other features once you are sure it works.
Let us know.