toomuchio / plex-nginx-reverseproxy

Configuration to serve Plex Media Center https://plex.tv using Nginx https://nginx.com
659 stars 94 forks source link

Fire TV Stick not showing any cover art #29

Closed a3rosol closed 6 years ago

a3rosol commented 6 years ago

Hi! I have a weird problem. Every client works perfectly fine except my amazon fire tv stick. It just doesn't show any cover art, backdrops etc. I can't figure it out. Metadata and the actual videos are playing without a hitch.

I've looked into the device logs from the plex app on the fire tv stick with no luck. My nginx logs aren't indicating something abnormal as well. Plex logs are also fine.

Could this be a TLS issue? Are pictures somehow treated differently than metadata and videos? Can you give me some tips to further investigate this issue on my own?

toomuchio commented 6 years ago

Did the problem start after enabling this config? Have you tried factory resetting the device?

To debug you can't do much but look at the device logs and nginx logs, you could MITM the device as well I guess to see exactly what it's requesting. I don't think it's an issue with the config, I'm quite sure I've read people are using the Fire Stick without issue I remember because I had to add a workaround for it back before Plex was doing redirects.

a3rosol commented 6 years ago

I bought the fire tv stick just 2 weeks ago. My config (it differs in a few ways from yours) is much longer in place and has worked flawlessly for most clients. What is bugging me is, the rest -metadata, theme songs, actual content... is loaded from the same server. This is really annoying

Factory reset: several times. Deleting caches, data etc. maybe I should try to mitm it or disable the tls stuff and try it this way.

toomuchio commented 6 years ago

If you've made modifications it could be something you've done, are you sure this stuff works without the config, perhaps its' an issue with your Plex server. TLS only becomes an issue if you force TLS, so long as you listen on both 80 and 443 it shouldn't be an issue for clients with no TLS support.

a3rosol commented 6 years ago

I only listen on 443. Maybe this is it. But I will not change that, it's 2018... Could it be a problem with CORS?

toomuchio commented 6 years ago

If you've turned off HTTP you're going to break a number of devices, yes if you incorrectly configured CORS that could also be a problem if the FireTV HTTP libs respect CORS. It could just be as simple as metadata requests fly over HTTP instead of HTTPS.

This really seems like an issue with your modifications and not the config, so I can't really help.

a3rosol commented 6 years ago

What would be the correct way to configure CORS? There is no mention of it in your config Metadata always moves over HTTPS, as it is the only way to access the server...

toomuchio commented 6 years ago

The album requests and the things you're having issues with may be requested over HTTP (while the rest is HTTPS) for the Fire TV Stick is my point, we don't know how the Plex client internals work since it's not open source.

The config doesn't apply any changes to CORS headers or apply a CSP, sorry but perhaps I misunderstood it sounded like you had added a CORS or CSP header of your own.

But as I said the problem seems to stem from modifications you've made so I can't help you any further until I can confirm it's an issue with the straight up cloned copy of my config. Unfortunately I don't have a Fire TV Stick to test.

a3rosol commented 6 years ago

According to my nginx access logs they are requested via HTTPS, get a 200 and done. [25/Jan/2018:00:19:09 +0100] "GET /photo/:/transcode?height=390&width=390&machineIdentifier=MYMACHINEID&url=http%3A%2F%2F127.0.0.1%3A32400%2Flibrary%2Fmetadata%2F9935%2Fthumb%2F1516799509&X-Plex-Token=MYTOKEN HTTP/2.0" 200 28289 "-" "okhttp/2.6.0" "-" Checked the file manually in firefox: works great. Maybe it's really the client that can't handle the rest...

Anyway, thanks! I guess this just won't work and I'll have to get used to it.

a3rosol commented 6 years ago

Allright. Found the culprit! It was http2. Once I forced http 1.1 everything was dandy. Maybe it has something to do with the really really old version of okhttp (current version is 3.9.1). So, it's not a problem with any config but a problem with the client. I'll file a bug report with plex.

toomuchio commented 6 years ago

Ah nice detective work there, that's super weird... If http2 isn't supported it should just downgrade to http 1.1, I guess okhttp has a bad implementation? I'll close this off and add a comment to the config perhaps.

seuffert commented 6 years ago

i can confirm this issue with http2 & the plex android client :( to bad we can't just disable http2 for the plex proxy nginx server entry.

If you enable http2 in the nginx conf on an IP:PORT combination in any virtual server config, it is enabled for all virtual server entries with this combination (using different server_name). To disable http2, it has to be removed in all corresponding entries, which is no option if you use the standard 443 port.

a3rosol commented 6 years ago

It's a bad okhttp implementation. I tested it with a newer version yesterday and it worked in a basic client. I solved the issue you mentioned with another ip address for plex/nginx. One ip handles http2 and the other only supports http 1.1. If you have the option to get another ip, you can solve it this way 😊

jamesonp commented 6 years ago

I can also confirm this issue is with http2. Disabling http2 fixes the thumbnail display on Android and Fire TV devices... Not an ideal situation.

Censored3 commented 6 years ago

I investigated the exact same problem the last couple of days. According to my detective work, it's not related to http2 directly, but rather to the "okhttp" client not sending SNI/Host correctly. At first, I also came to the conclusion http2 was the culprit, however at that time, the PMS interface was the default vhost as well. As soon as I added other vhosts and changed the default, even HTTP1.1 stopped working. I verified it by again putting PMS as default vhost, and it started working again. If I recall correctly, http2 spec requires a SNI/Host, which explains why http2 never works.

See https://forums.plex.tv/discussion/323573/no-posters-with-http-2-0 - I posted this issue there and it got cross-reffed :-) So next idea I have to workaround this, is to check for user-agent and -always- pipe "okhttp" UA to PMS vhost. But I have no idea whether that's possible with nginx (or even technically possible). Dedicating an IP or port to only PMS should indeed work as well b/c you're falling in the default vhost again, but http2 will need to stay disabled.

gdob commented 5 years ago

FWIW, I think this was fixed. Mine’s working fine with http2 enabled now.

jamesonp commented 5 years ago

I can also confirm this appears fixed

desimaniac commented 5 years ago

Pretty sure they fixed it in this version:

Plex for Android 7.3.0. https://forums.plex.tv/t/plex-for-android/29115/278

FIXES:

Resolve image loading when server only accessible via reverse proxy.