Server Version#: 4.12.3
Player Version#: various
I’m really hoping I can get some dev/staff input on this particular info. I realize my specific configuration is non-standard, and possibly not supported (albeit there is a decent size community which uses this configuration). While this may not be a bug, there is definitely an anomaly in how things are working architecturally, and I would really like for someone from the Plex team to at least explain to me how these apps are functioning, so I can understand why I have these issues.
My understanding is that somehow the mobile apps always communicate with some central Plex servers initially, which perform some sort of testing to determine if the user’s own Plex server(s) on their account are reachable. It then returns this information to the mobile client which will then attempt a direct connection to the user’s Plex server. Based on my observations I believe there are some checks that are causing Plex to report back that a server is not reachable when indeed it is. Beyond this, I can’t explain exactly what is happening. Additionally, if I am wrong about the above statements, I also have no idea why I am having these issues:
I am using Plex via NGINX reverse proxy. There are many guides on how to set this up online and many of them use a configuration similar to this. Part of the configuration details DISABLING the remote access option in Plex, which should in part force all traffic only through NGINX. In my case I am forwarding all incoming 443 traffic to plex.mydomain.com to my NGINX server which directs it upstream to my server over port 32400. My NGINX server is secured with a 3rd party SSL certificate issued by Let’s Encrypt.
With this configuration I can access my Plex server remotely in the following ways:
https://app.plex.tv - Will show a secure connection via the Plex GmbH DigiCert certificate.
https://plex.mydomain.com - Will show a secure connection via my Let’s Encrypt cert.
In both cases my server shows with the green “Remote” lock next to it via the web-app.
However, I am unable to access my server using the Android or Roku apps which show my server as offline/unreachable.
Initially, I thought this was possibly due to my ISP blocking port 80, so I am unable to allow any http connections through at all. I was attempting to setup some type of redirect from http://plex.mydomain.com to https://plex.mydomain.com in case these mobile apps were attempting a connection over 80 first. In trying to solve this problem I decided to migrate my DNS over to Cloudflare for 2 reasons:
- I was told that they had an easy way to blanket redirect all http requests
- There are quite a few guides our there for using this configuration with Cloudflare. Most of those seem to have to do with peering advantages, but since many had reported successful configurations with NGINX/Plex/Cloudflare, I decided to give it a final try.
What I have found is that if I configure my DNS entry for plex.mydomain.com in Cloudflare as a standard (e.g. non-proxied) Cloudflare entry, then DNS queries for plex.mydomain.com will return my NGINX WAN address. Presumably this means anything attempting to communicate with my internal Plex server will first try to hit my NGINX server directly. This configuration has the same results described above, namely the Android/Roku clients fail to connect. This was also the same results I saw prior to my DNS being switched to Cloudflare (makes sense since I am using CF here as a standard/gray DNS entry).
If however I set my DNS entry to proxied via Cloudflare (using Full SSL), then DNS queries for plex.mydomain.com return a Cloudflare IP (104.16.0.0-104.31.255.255). Presumably this means anything attempting communication with my internal Plex server will first hit Cloudflare, which will then make the connection to my NGINX server and then proxy this back to the client. In this configuration my remote clients all work as expected!
I have not setup any redirection rules in Cloudflare, so indeed attempt to access my site at http://plex.mydomain.com will always fail when accessed through a browser. Cloudflare will deliver a 522 “Connection Timed Out” error showing the timeout on my host (NGINX server).
Because of this I don’t believe my initial assumption of my ISP blocking port 80 has anything to do with this.
When viewing the access logs on my NGINX server I never see any traffic coming in when using the non-proxied/direct connection.
When using the proxied connection, clearly my logs show tons of events, as I am obviously communicating with my server since it works!
This would seem to indicate that whatever process is responsible for determining the availability of my server has an issue when checking with my NGINX server directly, but works when Cloudflare initially answers the connection and then forwards it to my same NGINX server.
I have only two theories, neither of which seems very good:
-
The port 80 thing: Cloudflare at least returns an actual webpage to show the 522 issue over port 80. Perhaps Plex requires this somehow. Seems unlikely, also because it takes quite a while to return this 522 over a browser and my mobile clients seem to connect quickly.
-
A certificate issue: When connecting via Cloudflare proxy, the Cloudflare shared certificate is used. When connecting directly my Let’s Encrypt certificate is used. I don’t have a problem with my LE certificate over the web-app. The certificate is a totally valid 3rd party cert that should be trusted by all, but this is one of the only other differences I can perceive.
I see no reason why I should have to proxy my connection through Cloudflare for my configuration to work, but yet I do - and I’m hoping to find a reason why.