Wss support for jellyfin

Hello,
I'm having issues with my jellyfin clients that is failing to open a websocket to jellyfin behind traefik.

I have posted an issue at jellyfin since I believe jellyfin is part of the issue not following 301 redirects, but looking into their python code I believe they ask for wss://jellyfin.example.com and should not be redirected.

In my traefik access logs I do see something strange :

10.0.30.112 - - [26/Apr/2021:10:30:58 +0000] "GET /socket?api_key=XXX&device_id=XXX HTTP/1.1" 301 164 "-" "-" 22030 "websecure-jellyfin@docker" "-" 0ms
10.0.30.112 - - [26/Apr/2021:10:30:58 +0000] "GET /Sessions?DeviceId=XXX HTTP/1.1" 200 745 "-" "-" 22032 "websecure-jellyfin@docker" "http://172.19.0.21:8096" 1ms

Looking at the log-format of traefik:
<remote_IP_address> - <client_user_name_if_available> [<timestamp>] "<request_method> <request_path> <request_protocol>" <origin_server_HTTP_status> <origin_server_content_size> "<request_referrer>" "<request_user_agent>" <number_of_requests_received_since_Traefik_started> "<Traefik_router_name>" "<Traefik_server_URL>" <request_duration_in_ms>ms

I see that somehow the "<Traefik_server_URL>" is empty for the socket request where it it not for a standard GET...

Is this normal or is this an issue with my router not matching the wss or ws query to the backend ?

I could expect this to be normal if they made a ws request and not wss since traefik is redirecting to https by itself without asking the backend... Is it as simple as that ? But then the Traefik_router_name is already the websecure one that is listening on port 443 so it should already be an https/wss request, why would it be redirected before even asking the backend and to where does it point ?

You can look at my issue on jellyfin for more details and detailed conf of my jellyfin docker container with all the traefik labels...

Any help, even to just enable more logs (like log the content of responses by traefik or backends if status-code is 301...), will be warmly recieved !

Thanks in advance!

Anyone managed to run jellyfin behind traefik successfully?

Yeah ! It works like a charm:
Here's jellyfin configuration : make-my-server/docker-compose.jellyfin.yml at master · tomMoulard/make-my-server · GitHub

And here's traefik one : make-my-server/docker-compose.traefik.yml at master · tomMoulard/make-my-server · GitHub

Hope it helps :slight_smile:

1 Like

Thanks a lot.
Looks very similar to what I'm doing, nothing special that I could add really (just discovered that passing labels to the treafik container can avoid me some toml config, thx !)
So I don't understand why it would fail for me.
Do you also use jellyfin Kodi plugin to access the jellyfin server using it's "public" url ?
Because for me all works well in the web UI, only the Kodi plugin fails to play correctly probably because of this 301 wss redirect...