HTTPS broken

This is quite frustrating and crappy from Plex. The only way I could think of getting around it was to create a local http proxy that’d interface to the httpS endpoint in the internet.

I have something working for this. I’m curious to see if this fixes your issue as well, @ddn.

The way I managed to get around it was creating an http proxy

  1. Install Node
  2. Install http-proxy

npm install http-proxy --save

  1. Open Node and setup a http proxy

var httpProxy = require(‘http-proxy’);
httpProxy.createServer({changeOrigin: true, target: ‘https://www.thesportsdb.com’}).listen(8006);

  1. Modify the agentservice.py file in Plex

sudo vim /usr/lib/plexmediaserver/Resources/Plug-ins-78232c603/System.bundle/Contents/Code/agentservice.py

Around line 1034, make it so the media_url is replaced with localhost when trying to request from sportdb (or whatever your source is).

media_url = preview_elements[0].get(‘url’).replace(“https://www.thesportsdb.com”, “http://localhost:8006”)

  1. restart plex

Very hacky, but did the job…

Couple logical improvements and concerns:

  1. Make the node script start with the system.
  2. Concern: What will happen when I upgrade Plex? Will my line change get overriden?
    2.1 Perhaps, rather than changing the Plex code, /etc/hosts file can be changed to point external https url to localhost proxy (thinking out loud here). That way I wouldn’t need to change code. But this would cause all Browsing and other apps to go through proxy as well.