-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with reverseProxy traefik #502
Comments
Check Kodi logs for any errors. I'm going through a nginx reverse proxy and have no issues. https://kodi.wiki/view/Log_file/Easy Also, if you're switching server URL, make sure you do a full database reset from the addon menu and "Reset addon data". Changing it while media is already synced doesn't work currently. |
I did the full reset.
This looks to be an issue with websockets and if it gets a 301 status I expect it is beeing redirected to use https... But I have no difficulties with websockets on other docker containers (wetty for instance) behind the same traefik with the same automatic docker settings with labels... Also, I got some messages like this:
And when I take the very same url in my browser on the same windows machine I get an almost instant response showing me the picture... Could it be that kodi does not recognize letsencrypt as a trusted cert ? Probably the log would be different.. I'm relly not seeing what is happening here.. Do you happen to know in in what way the playback in kodi is so different from the web ui of jellyfin ? Any help is very appreciated. Thanks in advance ! Edit: I read here that some ws libraries just don't follow redirect and instead throw an error. Maybe you're not using the same lib as thee guys but could have the same issue... Hope someone can look into it and either fix by following the redirects, or maybe help me find some more logs to see where it is being redirected to (as of now I'm not even seeing where ws_client tries to connect... The server url is explicitely https://jellyfin.example.com so if it uses only https it should never see a 301 redirect anyway...) Edit 2: I found where it's trying to connect :
And using this I have been able to confirm that the very url this log is showing answers me with a 101 code switching to websocket protocol, no 301 redirect. I'm not able to go further and chat with the websocket since I don't know it's language, but hey, that looks good to me ;) So no idea why this keeps crashing... Even enabling log level debug in jellyfin I'm not getting much more info, fails with status 301 but that's all it says, 301 usually gives a location to go to but jellyfin ws logic does not log it even in debug... Edit 3: I looked at my traefik logs and I also see the 301 without much more info...
Looking at the log-format of traefik: I see that somehow the "<Traefik_server_URL>" is empty for the socket request where it it not for a standard GET... So it might still be a traefik issue... Should I use a specific port for ws on jellyfin ? I do think traefik is perfectly capable of proxying a wss request into a ws backend and it works for many other containers I run with the same conf... |
I tested out someone's traefik config and I'm still getting the same error, I agree that I might be able somewhere to avoid 301 redirect, but I also think it would make sense for Kodi plugin to simply follow 301 redirects for the wss and not simply fail with an error. |
A lot of things aren't adding up here. There's no configuration available for the websocket URL. It's based off the saved server URL that you're using. And to answer your question, if everything is configured properly, there's exactly 0 reason for us to ever handle a 301 redirect on the websocket side, unless the server admin is doing some crazy rewriting that I don't understand.
If your server is using https, it will automatically use |
Thanks for your help, Let me provide some more logs to help : This is the startup of kodi after a "local database reset" keeping the jellyfin addon settings : https://pastebin.ubuntu.com/p/hDwnZDPy92/ I've cut it after retrieving the first show since it's getting huge... One unexplainable issue is that leter on in the log I see lots of this:
And this is probably the source of my not having any thumbnails in the library.
Now I understand that wss is not required to play the file, but indeed it still fails, here is some log of me attempting to play a file : Also, since this wss is failing somehow, probably the plugin is not giving up on reporting progress, and it keeps displaying me a rotating waiting animation instead of playing the show. As you can see, I have turned down loglevel to info otherwise I get lost... |
I've edited websocket.py to trace the request headers and response, here is what I got :
Probably the origin still beeing http is causing this, I'm going to try to tweak the requets headers, but otherwise location seems the same as source... I'm not that good with python but I can still edit the file ;) so if you can help me try to make it follow redirects just for test, I could see if it helps... Thanks in advance. |
Ok, seems I solved it by cleaning up my traefik labels and adding a general X-Forwarded-Proto middleware on traefik, now the handshake gets a proper 101 response.
And this url works properly in my browser as I said. Maybe CCurlFile isn't doing SNI properly ? Anyone had the issue too ? Or an idea to solve it ? |
Since you have it working now, can you verify if our traefik docs are correct? Traefik 1 - https://github.com/jellyfin/jellyfin-docs/blob/master/general/networking/traefik.md As for the thumbnails, there's another open issue (that I also can't replicate) where we're trying to track down what's happening there #505 |
So, traefik1 I can't check, but for traefik 2 in fact I had all the labels from your doc and somehow it was not working, I trashed everything and ended up only with the following labels :
Rest looks fine. I'll try again your mw to see why it failed for me... |
Going one by one, I've managed to identify that the SSLForceHost label is the one causing the wss query to get a 301...
Probably getting mixed up with host jellyfin.example.com and jellyfin.example.com:443 as well... Now that did not help me with the missing thumbnails... Trying to dig into it now.. |
Sounds like this issue is resolved, we'll discuss the thumbnails in the other issue so we don't get split brain on it. |
I have a nice setup running jellyfin on docker with traefik as reverse proxy, it works extremely well in any browser, but kodi plugin has a lot of issues.
To be clear, when I setup the kodi plugin to use server "jellyfin.lan:8096" everything works perfectly.
But when I set the server to "jellyfin.example.com" it has a lot of issues :
I have a valid letsencrypt certificate for jellyfin.example.com, http always redirects to https, and as explained, it works very very wel in a browser.
I have tried a lot of things but cannot find the issue... I started kodi both n my mibox3, but also on my windows10 machine and same in both places.
I suspect jellyfin plugin could either refuse to follow http to https redirects, or it does not use SNI when making requests and traefik will server the default cert which is invalid... I have even tried to disbale "verify connection" in the settings but it does not help...
Any help is appreciated.
Here is my compose.yml to deploy jellyfin : I left the comments for you to see what I have tried but unsucessfully each time)
Note : JELLYFIN_PublishedServerUrl I tried with or without https...
Here is what I get in https://jellyfin.example.com/System/Info/Public
I even got hardware decoding/encoding working, web UI is really snappy to start/stop reading movies and tc shows, even big high-def ones...
I tried to run fiddler on my windows machine running kodi and inspecting https, when connecting to jellyfin.example.com I do the the redirect from http to https, but after that I see a TLS start that gets closed right away. I suspect it's due to fiddler having a cert not trusted by kodi despite beeing in the windows trusted store... When fiddler is disabled I do get connectivity, the library is synced, but as explained, no thumbs, and very buggy playback.
Again, thanks a lot for any idea on how to get this working.
The text was updated successfully, but these errors were encountered: