I’m trying to proxy requests to my server through Cloudflare (HTTPS), as the direct peering from some locations to my server is very slow. This works fine with Plex Web, Plex for iOS and Plex for Android.
When using the PS4 Client (1.40), browsing the library works fine, but playing an item results in the error “There was a problem playing this item. The video did not start playing in time.”
IPADDRESS - - [30/Apr/2018:23:23:52 +0200] "GET /video/:/transcode/universal/decision?hasMDE=1&path=%2Flibrary%2Fmetadata%2F1201&mediaIndex=0&partIndex=0&protocol=hls&fastSeek=1&directPlay=0&directStream=1&subtitleSize=100&audioBoost=100&location=wan&maxVideoBitrate=4000&videoQuality=100&videoResolution=1280x720&session=incnvx4jlzykqldxpqkkw9b7&subtitles=burn&Accept-Language=en&X-Plex-Session-Identifier=upgewak8nepe5wua1kzxpse4&X-Plex-Client-Profile-Extra=add-limitation%28scope%3DvideoCodec%26scopeName%3D%2A%26type%3DupperBound%26name%3Dvideo.bitrate%26value%3D4000%26replace%3Dtrue%29%2Badd-limitation%28scope%3DvideoCodec%26scopeName%3Dh264%26type%3DupperBound%26name%3Dvideo.level%26value%3D41%26replace%3Dtrue%29%2Badd-limitation%28scope%3DvideoCodec%26scopeName%3Dh264%26type%3DupperBound%26name%3Dvideo.level%26value%3D41%26replace%3Dtrue%29%2Badd-transcode-target-audio-codec%28type%3DvideoProfile%26context%3Dstreaming%26protocol%3Dhls%26audioCodec%3Dac3%26replace%3Dtrue%29%2Badd-limitation%28scope%3DvideoAudioCodec%26scopeName%3Dac3%26type%3DupperBound%26name%3Daudio.channels%26value%3D6%26replace%3Dtrue%29&X-Plex-Client-Identifier=pqk7fbesm2jedmmy52zsadxx&X-Plex-Device-Screen-Resolution=1280x720&X-Plex-Version=3.13.13&X-Plex-Product=Plex%20for%20PlayStation%204&X-Plex-Platform=WebMAF&X-Plex-Platform-Version=01.40&X-Plex-Device=PlayStation%204&X-Plex-Token=redacted&X-Plex-Client-Profile-Name=PlayStation%204%20App&X-Plex-No-Cache=15251234122961088 HTTP/1.1" 200 1177
IPADDRESS - - [30/Apr/2018:23:23:53 +0200] "GET /:/timeline?hasMDE=1&ratingKey=1201&key=%2Flibrary%2Fmetadata%2F1201&state=buffering&playQueueItemID=2187&time=1148064&duration=2957600&X-Plex-No-Cache=15251234325431101&X-Plex-Client-Identifier=pqk7fbesm2jedmmy52zsadxx&X-Plex-Device-Screen-Resolution=1280x720&X-Plex-Version=3.13.13&X-Plex-Product=Plex%20for%20PlayStation%204&X-Plex-Platform=WebMAF&X-Plex-Platform-Version=01.40&X-Plex-Device=PlayStation%204&X-Plex-Token=redacted&X-Plex-Session-Identifier=upgewak8nepe5wua1kzxpse4 HTTP/1.1" 200 160
The App never requests the start.m3u8 file, compared to when forcing the client to use http:
IPADDRESS - - [30/Apr/2018:22:31:49 +0200] "GET /video/:/transcode/universal/decision?hasMDE=1&path=%2Flibrary%2Fmetadata%2F1201&mediaIndex=0&partIndex=0&protocol=hls&fastSeek=1&directPlay=0&directStream=1&subtitleSize=100&audioBoost=100&location=wan&maxVideoBitrate=4000&videoQuality=100&videoResolution=1280x720&session=j927e4g77rpf1c2hveakldbj&subtitles=burn&Accept-Language=en&X-Plex-Session-Identifier=gk2z0m4ociwlz5lmti3iiniv&X-Plex-Client-Profile-Extra=add-limitation%28scope%3DvideoCodec%26scopeName%3D%2A%26type%3DupperBound%26name%3Dvideo.bitrate%26value%3D4000%26replace%3Dtrue%29%2Badd-limitation%28scope%3DvideoCodec%26scopeName%3Dh264%26type%3DupperBound%26name%3Dvideo.level%26value%3D41%26replace%3Dtrue%29%2Badd-limitation%28scope%3DvideoCodec%26scopeName%3Dh264%26type%3DupperBound%26name%3Dvideo.level%26value%3D41%26replace%3Dtrue%29%2Badd-transcode-target-audio-codec%28type%3DvideoProfile%26context%3Dstreaming%26protocol%3Dhls%26audioCodec%3Dac3%26replace%3Dtrue%29%2Badd-limitation%28scope%3DvideoAudioCodec%26scopeName%3Dac3%26type%3DupperBound%26name%3Daudio.channels%26value%3D6%26replace%3Dtrue%29&X-Plex-Client-Identifier=pqk7fbesm2jedmmy52zsadxx&X-Plex-Device-Screen-Resolution=1280x720&X-Plex-Version=3.13.13&X-Plex-Product=Plex%20for%20PlayStation%204&X-Plex-Platform=WebMAF&X-Plex-Platform-Version=01.40&X-Plex-Device=PlayStation%204&X-Plex-Token=redacted&X-Plex-Client-Profile-Name=PlayStation%204%20App&X-Plex-No-Cache=1525120306323914 HTTP/1.1" 200 1174
IPADDRESS - - [30/Apr/2018:22:31:50 +0200] "GET /video/:/transcode/universal/start.m3u8?hasMDE=1&path=%2Flibrary%2Fmetadata%2F1201&mediaIndex=0&partIndex=0&protocol=hls&fastSeek=1&directPlay=0&directStream=1&subtitleSize=100&audioBoost=100&location=wan&maxVideoBitrate=4000&videoQuality=100&videoResolution=1280x720&session=j927e4g77rpf1c2hveakldbj&subtitles=burn&Accept-Language=en&X-Plex-Session-Identifier=gk2z0m4ociwlz5lmti3iiniv&X-Plex-Client-Profile-Extra=add-limitation%28scope%3DvideoCodec%26scopeName%3D%2A%26type%3DupperBound%26name%3Dvideo.bitrate%26value%3D4000%26replace%3Dtrue%29%2Badd-limitation%28scope%3DvideoCodec%26scopeName%3Dh264%26type%3DupperBound%26name%3Dvideo.level%26value%3D41%26replace%3Dtrue%29%2Badd-limitation%28scope%3DvideoCodec%26scopeName%3Dh264%26type%3DupperBound%26name%3Dvideo.level%26value%3D41%26replace%3Dtrue%29%2Badd-transcode-target-audio-codec%28type%3DvideoProfile%26context%3Dstreaming%26protocol%3Dhls%26audioCodec%3Dac3%26replace%3Dtrue%29%2Badd-limitation%28scope%3DvideoAudioCodec%26scopeName%3Dac3%26type%3DupperBound%26name%3Daudio.channels%26value%3D6%26replace%3Dtrue%29&X-Plex-Client-Identifier=pqk7fbesm2jedmmy52zsadxx&X-Plex-Device-Screen-Resolution=1280x720&X-Plex-Version=3.13.13&X-Plex-Product=Plex%20for%20PlayStation%204&X-Plex-Platform=WebMAF&X-Plex-Platform-Version=01.40&X-Plex-Device=PlayStation%204&X-Plex-Token=redacted&X-Plex-Client-Profile-Name=PlayStation%204%20App HTTP/1.1" 200 157
You can reproduce this by disabling remote access to the server (make sure that you are not on the same network) and map the Plex port to a port Cloudflare supports (e.g. 8443), on Linux:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8443 -j REDIRECT --to-port 32400
Create a DNS record in Cloudflare pointing to the Public IP of the Plex server and enable proxying.
Then add “https://foo.your-cloudflare-domain.com:8443” to the “Custom server access URLs” of your Plex server.