Hey there,
I am desperately trying to get websockets to work on port 443. I cannot use a different port, as 80 and 443 are the only ports not getting blocked by the clients firewall. :-/
But I keep getting a 502 Bad Gateway error.
This is my config:
version: "3.9" # optional since v1.27.0
services:
reverse-proxy:
# The official v2 Traefik docker image
image: traefik:v2.8
container_name: traefik
# Enables the web UI and tells Traefik to listen to docker
command:
- "--api.insecure=true"
- "--providers.docker"
- "--providers.file.directory=/etc/traefik/dynamic_conf/"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
ports:
# The HTTP port
- "80:80"
- "443:443"
# The Web UI (enabled by --api.insecure=true)
- "8000:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
- ../setup/ssl:/tools/certs
- ../setup/traefik/certs-traefik.yml:/etc/traefik/dynamic_conf/conf.yml
networks:
vpcbr:
ipv4_address: 10.5.0.2
labels:
- traefik.http.routers.traefik=true
- traefik.http.routers.traefik.entrypoints=websecure
- traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https,wss
- traefik.http.routers.traefik.middlewares=sslheader@docker
- traefik.http.routers.traefik.tls=true
- traefik.http.routers.traefik.rule=Host(`traefik.showroom.local`)
websocket:
image: node:12.22.2-alpine
container_name: websocket
mem_limit: 2G
working_dir: /home/node/app
command: sh /home/node/app/run.sh
expose:
- 8081
volumes:
- ../apps/ws:/home/node/app
- ../setup/ssl:/home/node/app/ssl
networks:
vpcbr:
ipv4_address: 10.5.0.6
labels:
- traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https,wss
- traefik.http.routers.websocket.middlewares=sslheader@docker
- traefik.http.routers.websocket.tls=true
- traefik.http.routers.websocket.rule=Host(`ws.showroom.local`)
- traefik.http.routers.websocket.entrypoints=websecure
Any idea what is wrong here?