jellyfin/jellycon

JellyCon playback fails when using reverse proxy

krutburken opened this issue ยท 8 comments

Describe the bug
This issue has been bugging me for a long time but I finally figured out what's causing it. When using JellyCon and connecting to a server behind a nginx reverse proxy with ssl enabled (letsencrypt), playback either doesn't start at all, or stalls after 1-3 seconds and won't continue. Problem goes away if you bypass the proxy. Strangely, playback also works fine if you long-press and choose Force Transcode instead of playing normally. No other apps have problems with playback using the proxy (jellyfin-kodi, Webplayer, android-tv, Infuse, JMP, etc.). The android-tv app works fine using the proxy on the same device as JellyCon.

To Reproduce

  1. Use JellyCon with a server behind ssl enabled reverse proxy
  2. Play a movie normally (just click on an item)
  3. Playback stalls after a second or doesn't start at all

Expected behavior
Item plays normally.

Logs
No errors are logged.

System (please complete the following information):

  • OS: Android 11
  • Jellyfin Version: 10.8.10
  • Kodi Version: 20.1
  • Addon Version: 0.7.0

I have a very similar setup to you, but don't have this problem. Jellyfin, running on a server behind an NGINX proxy with Let's Encrypt.

Could it be related to either your Jellyfin setup, NGINX configuration, or firewall? Maybe just some things to double-check.

Jellyfin

Make sure in Jellyfin you have PublishedServerUrl set correctly. For example, if using Docker Compose, it'd look something like this:

version: "3.8"
services:
  jellyfin:
    image: jellyfin/jellyfin:unstable
    ports:
      - "8096:8096/tcp"
      - "8920:8920/tcp"
      - "1900:1900/udp"
      - "7359:7359/udp"
    user: 1000:1000
    restart: "unless-stopped"
    volumes:
      - ./config/:/config/
      - ./cache/:/cache/
      - ./media/:/media/ 
    environment:
      JELLYFIN_PublishedServerUrl: "https://jellyfin.example.org"

NGINX

The Jellyfin documentation includes an in-depth NGINX configuration to use, if you haven't already, do give it a peek!

Reference: Jellyfin Documentation for NGINX Reverse Proxy

At a minimum, something like this should work which is what I use:

server {
  server_name jellyfin.example.org;

  location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://localhost:8096/;
  }

  add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

  # {{SSL stuff managed by Certbot}}
}

server {
  # {{SSL stuff managed by Certbot}}

  listen 80;
  listen [::]:80;

  server_name jellyfin.example.org;
  # {{SSL stuff managed by Certbot}}
}

Hey,

I did sadly already double-check these things you mention without any change in behaviour (made a new nginx config literally copy/pasted from the documentation, thinking I had some error in it). I actually don't own the device anymore as Kodi was the only reliable player for Jellyfin on Android TV.

The strange thing is, when I (mostly for fun) tried to sideload Kodi onto my current Apple TV, Jellycon worked fine with the proxy. I then tried it on my old Shield TV again, and the error returned. Factory reset of the device did not change anything, and after further testing it apparently works fine on the Google TV, and a Linux Desktop PC as well. I guess I was hitting some strange edge case specific for the Nvidia Shield TV, or there was something wrong with it (which is unlikely since all other clients I tested on it worked fine with the same source media).

I did a logcat on the device at the time and there were no errors from what I can remember, only that it tried to play the file but stalled after a very short time. The only thing that stood out was that Kodi cpu usage spiked when playback was attempted, and the only thing you could do about it was to kill the application for the device to become usable again. Like before, if you Force Transcode in Jellycon, media plays normally.

Anyways. Like I said, I don't own a Shield TV (or any android-tv device) anymore so I'm no longer able to reproduce the issue.

I am also facing this issue on a Shield TV, good to know bypassing the proxy works! Thanks

I am facing exactly the same issue on CCwGTV. Kodi doesn't play, black screen. When attempting to stop, Kodi freezes and the app needs a force shutdown.

I've never encountered issues with a reverse proxy specifically, and I've been using nginx on mine forever. However I have noticed occasional weirdness with SSL verification and androidtv systems. Haven't managed to track down exactly where the issue lies, but I always saw it during initial setup, not during playback. Might be worth trying to disable SSL verification in the addon settings to see if that has any effect

I did try to disable SSL verification without any effect. The SSL connection works great on Android (native client) and with the direct web interface. The only place it doesn't work is Kodi. Only plain HTTP with ip:port, and http with nginx work there. Https with nginx: nope. I use LetsEncrypt.

After the SSL handshake, I get this from the Kodi SSL debug log for the time it buffers, suggesting a bunch of null-length fragments:

image

Try to remove HTTP2 in NGINX

I too was having crashes when connecting to Jellyfin via reverse proxy (nginx). After pulling my hair out for a couple of days the solution was to disable HTTP2 in Kodi by adding the config below to advancedsettngs.xml to Kodi userdata folder.

<advancedsettings version="1.0">
	<network>
	  <disablehttp2>true</disablehttp2>
	</network>
</advancedsettings>

I also have HTTP2 disabled in Nginx. Playing perfectly now, no crashes, can seek, stop video, pause and resume no problem.