Plex Transcoding Issues (Nginx + Cloudflare)

Howdy peeps,

I setup a Plex server sitting behind Cloudflare (nginx reverse proxy).
Routing is shit, and cloudflare fixes this immediately with zero buffering issues.

Customer server address is set, port 32400 is blocked, everything works beautifully in original quality.
Until you try to play anything that requires transcoding… I then get a:

An error occurred trying to play "XXXXXXXXX".

Error code: s1001 (Network)

Now the thing is, the moment I grey cloud cloudflare (changing nothing in terms of settings, etc), the error disappears and transcoded content plays just fine.

I’m lost. :S

Try using the developer console on Chrome.

CloudFlare may be blocking your request (showing CAPTCHA page instead of returing the video).

Go to Firewall → Firewall Rules → Create a Firewall Rule
Set your IP/ASN or and 0::0/0 to Allow and see if that helps

1 Like

I didn’t think of that :open_mouth:

Here’s what I see:

[Player] A critical Shaka error occurred: s1001 (Unknown) – URI: https://XXXXXXXXXXXX/video/:/transcode/universal/start.mpd?hasMDE=1&path=%2Flibrary%2Fmetadata%2F169&mediaIndex=0&partIndex=0&protocol=dash&fastSeek=1&directPlay=0&directStream=1&subtitleSize=125&audioBoost=100&location=wan&addDebugOverlay=0&autoAdjustQuality=0&directStreamAudio=1&mediaBufferSize=102400&session=XXXXXXXXXX&subtitles=auto&Accept-Language=en&X-Plex-Session-Identifier=XXXXXXXXXXXXX&X-Plex-Client-Profile-Extra=add-limitationcope%3DvideoCodeccopeName%3D%2A%26type%3DupperBound%26name%3Dvideo.height%26value%3D1280%26replace%3Dtrue%29%2Bappend-transcode-target-codec%28type%3DvideoProfile ontext%3Dstreaming%26audioCodec%3Daac%26protocol%3Ddash%29&X-Plex-Product=Plex%20Web&X-Plex-Version=3.108.2&X-Plex-Client-Identifier=XXXXXXXXX&X-Plex-Platform=Firefox&X-Plex-Platform-Version=68.0&X-Plex-Sync-Version=2&X-Plex-Features=external-media&X-Plex-Model=bundled&X-Plex-Device=Linux&X-Plex-Device-Name=Firefox&X-Plex-Device-Screen-Resolution=2560x1356%2C2560x1440&X-Plex-Token=REDACTED
<head><title>414 Request-URI Too Large</title></head>
<center><h1>414 Request-URI Too Large</h1></center>
 – Response headers: {
  "cf-ray": "50cee50eb8112491-DOH",
  "content-type": "text/html",
  "date": "Tue, 27 Aug 2019 14:56:53 GMT",
  "expect-ct": "max-age=604800, report-uri=REDACTED"\"",
  "referrer-policy": "strict-origin-when-cross-origin",
  "server": "cloudflare",
  "strict-transport-security": "max-age=15768000",
  "x-firefox-spdy": "h2"
}; the player cannot recover

Wild guess that this applies:

Looks like you’ll need to make a quick change to your nginx config:

client_header_buffer_size 64k;
large_client_header_buffers 4 64k;

Not sure why it would only be triggered when the cloudflare proxy is enabled, though. I would’ve thought that the settings apply no matter where the request originates from.


That worked!

I rechecked with Cloudflare on/off and it was indeed only happening with CF until I changed these settings in the Plex RP block.

They were set to this globally in nginx.conf

client_header_buffer_size 1k;
large_client_header_buffers 2 1k;

Thanks a ton :slight_smile:

1 Like

Does Cloudflare add X-Proxied-For: and other jazz to the header? Maybe that was enough to push it over the limit?


Yeah, that’s likely it. All the extra goodies they stuff in the header.

I know a few people using Cloudflare behind Plex, sure they got pissed.
Like the last guy who downloaded 2PB.

I’ve set it to bypass the cache, but my usage is (very) minimal anyway. Doubt they care.

Cloudflare only care if you’re actively using their caching for it, which should be obvious to people. Cloudflare should only be used with Plex to benefit user peering.

1 Like