I have an application (https://github.com/marthoc/docker-deconz) that expects HTTP and WebSocket traffic on different ports (80 and 443, respectively). Traefik configuration happens through Docker container labels. How would I setup traefik to send the respective traffic to those separate destinations using the same FQDN?
Hi @ginkel, just to be sure: do you want that:
-
http://FQDN:80
=> goes through Traefik => to the port 80 of your web application in HTTP
and -
wss://FQDN:443
=> goes through Traefik => to the port 443 of your web application in websockets
right?
Slightly different:
-
https://FQDN:443
=> goes through Traefik => to the port 80 of your web application in HTTP
and -
wss://FQDN:443
=> goes through Traefik => to the port 443 of your web application in websockets
Mmmh seems tedious if ever possible: Traefik router rule doesn't work with the protocols.
I initially thought that using the header Upgrade
could be a way to discriminate traffic with the , something like:
rule = Host(`company.org`) && Headers('upgrade','websockets')
but after reading a bit the MDN documentation (https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism),
it looks like that the "Upgrade" mechanism only works in HTTP/1.1, and doesn't with HTTP/2.
If checked how to do this with Nginx as well, and stumbled over the same kind of issue. If you have any knowledge about a reverse proxy that can do that, I'm curious to learn
Sounds like you have to specify a custom WSS port , other than 443, to the deconz image so you can create a dedicated Traefik endpoint and be able to use 443 externally for https.
Did you ever find a solution to this?
I'm trying to do the exact same, and about to go mad trying to figure out how to make it work.
I didn't and meanwhile switched from deCONZ to zigbee2mqtt as deCONZ turned out to be too unreliable for daily use...