I have an app composed of services like:
- tls termination (based on https-portal)
- reverse proxy (nginx)
- other services (web, api, wss, ...)
All the traffic goes this way:
https-portal -> nginx -> other services
I'm replacing https-portal with Traefik and I am not managing to have the websocket pass through correctly.
Below is the the excerpt of my docker-compose.yml file. The traffic coming to Traefik is forwarded to a dedicated port of the reverse proxy. This one will perform a couple of checks and then forward the requests to the appropriate service (api, web frontend, websocket server, ...)
# Proxy
proxy:
image: mynginxproxy
build: ../../../development/proxy
restart: always
labels:
- traefik.web.frontend.rule=Host:app.dev
- traefik.web.port=8000
- traefik.wss.frontend.rule=Host:wss.app.dev
- traefik.wss.protocol=ws
- traefik.wss.port=9002
- traefik.api.frontend.rule=Host:api.app.dev
- traefik.api.port=8002
- ... // other labels
# Traefik
traefik:
image: traefik
command: --web --docker --docker.domain=app.dev --logLevel=DEBUG
labels:
- "traefik.enable=false"
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /dev/null:/traefik.toml
When the web frontend is served, on app.dev domain, a websocket connection is tried on ws://wss.app.dev but it cannot connect to the underlying websocket server. The error seems to be linked to the Origin header which is set to app.dev where the targeted server is wss.app.dev.
Log form traefik:
traefik_1 | time="2017-08-02T13:55:05Z" level=warning msg="Error while upgrading connection : websocket: 'Origin' header value not allowed"
I'm not sure what I'm missing here as this pass through correctly with https-portal. Is there any additional option needed in Traefik?