# HTTPS broken

**URL:** <https://forums.plex.tv/t/https-broken/216635>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [December 6, 2017, 3:45am UTC](https://forums.plex.tv/t/https-broken/216635 "2017-12-06T03:45:38Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomyun](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/tomyun/32/82042_2.png) [@tomyun](https://forums.plex.tv/u/tomyun)\
**Post date:** [December 6, 2017, 3:45am UTC](https://forums.plex.tv/t/https-broken/216635/1 "2017-12-06T03:45:38Z")

</div>

`HTTP.Request()` to HTTPS URLs result into an error:

```auto
URLError: <urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)>

```

Seems like this has been an outstanding issue for sometime which requires an update for the built-in Python to at least 2.7.9 (which was released in 2014).

> **[Outdated SSL/Python? Handshake errors](https://forums.plex.tv/discussion/229031/outdated-ssl-python-handshake-errors)**
>
> Hi! I have ssl handshake problems on my Viaplay plugin - https://forums.plex.tv/discussion/82378/rel-viaplay-se-no-dk-fi#latest. I noticed that some “Vice” plugin had the same issue. On my local python installation the “python request module”...

  

> **[Fix for SNI SSL?](https://forums.plex.tv/discussion/248351/fix-for-sni-ssl)**
>
> Hi, Plex runs on Python 2.7.4 and SNI SSL support got added in Python 2.7.9. I’ve tried various things to get SNI working but everything I try, fails. Last thing I tried: I created a file...

  

> **[Plex Official Channel: Vice - SSL Error on Featured / Vice News](https://forums.plex.tv/discussion/222070/plex-official-channel-vice-ssl-error-on-featured-vice-news)**
>
> Seems to be something to do with http://www.vice.com/series/vice-news redirects to httpS://news.vice.com/ Standard exception in the logs, ending with the most important: SSL23\_GET\_SERVER\_HELLO:sslv3 alert handshake failure I have tried changing...

Since more and more websites are migrating to HTTPS by default, I’d say this could be a deal breaker for many channel plugins for Plex. Does anyone know whether Plex has a plan to address this issue?

---

<div class="post-metadata">

**Author:** ![JamminR](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jamminr/32/4261_2.png) [@JamminR](https://forums.plex.tv/u/JamminR)\
**Post date:** [December 8, 2017, 5:41am UTC](https://forums.plex.tv/t/https-broken/216635/2 "2017-12-08T05:41:50Z")

</div>

Someone does, but, Plex company will likely never tell anyone until after they update. That could be today. That could be 10 years. That could be never.  
I’ve suffered, and fortunately, got channel developers to do work-arounds, for several of the channels I use.  
And, honestly, I’ve not seen your error, but, usually see another error.  
Searching for “[CERTIFICATE\_VERIFY\_FAILED](https://forums.plex.tv/search?adv=&search=CERTIFICATE_VERIFY_FAILED&title=&author=&cat=all&tags=&discussion_d=1&discussion_question=1&discussion_poll=1&comment_c=1&comment_answer=1&within=1+day "CERTIFICATE\_VERIFY\_FAILED")” results in 44 posts.  
It seems Plex has been ignoring the error for several years.  
Scary thing… it even affected the ability of Plex to obtain metadata within some of their agents for several.

---

<div class="post-metadata">

**Author:** ![shopgirl284](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shopgirl284](https://forums.plex.tv/u/shopgirl284)\
**Post date:** [December 10, 2017, 9:47pm UTC](https://forums.plex.tv/t/https-broken/216635/3 "2017-12-10T21:47:37Z")

</div>

See [forums.plex.tv/discussion/290557/input-for-plex-player-app-pms-issues-with-plugin-framework](https://forums.plex.tv/discussion/290557/input-for-plex-player-app-pms-issues-with-plugin-framework "https://forums.plex.tv/discussion/290557/input-for-plex-player-app-pms-issues-with-plugin-framework")

---

<div class="post-metadata">

**Author:** ![ddn](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ddn/32/87158_2.png) [@ddn](https://forums.plex.tv/u/ddn)\
**Post date:** [March 25, 2018, 10:49pm UTC](https://forums.plex.tv/t/https-broken/216635/4 "2018-03-25T22:49:23Z")

</div>

Is anyone going to fix this?

This basically breaks all scanners or agents that need HTTPS. The SNI issue is at least 5 years old.

---

<div class="post-metadata">

**Author:** ![JamminR](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jamminr/32/4261_2.png) [@JamminR](https://forums.plex.tv/u/JamminR)\
**Post date:** [March 25, 2018, 11:17pm UTC](https://forums.plex.tv/t/https-broken/216635/5 "2018-03-25T23:17:40Z")

</div>

@ddn - what’s your operating system?  
I’ve not seen SSL error in quite sometime on my WIndows box (but that might be due to the workarounds)  
Though Plex is still many versions behind, they’ve updated to Python 2.7.12 for Windows version of Plex sometime in the past year or two.  
M:\Program Files (x86)\Plex\Plex Media Server\>PlexScriptHost.exe --version  
Python 2.7.12

---

<div class="post-metadata">

**Author:** ![ddn](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ddn/32/87158_2.png) [@ddn](https://forums.plex.tv/u/ddn)\
**Post date:** [March 26, 2018, 12:15am UTC](https://forums.plex.tv/t/https-broken/216635/6 "2018-03-26T00:15:59Z")

</div>

The machine is a bit older so it’s running OS X Sierra. I could update it to HS, but I don’t think it would make any difference in this.

From what I can tell, Plex is using the python with internal libraries that ship with it, that are super old including using urrlib2.

I did try installing a completely separate python with brew, but I couldn’t get plex to use the /usr/local/bin/python vs system-installed.

---

<div class="post-metadata">

**Author:** ![ddn](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ddn/32/87158_2.png) [@ddn](https://forums.plex.tv/u/ddn)\
**Post date:** [March 26, 2018, 4:52pm UTC](https://forums.plex.tv/t/https-broken/216635/7 "2018-03-26T16:52:28Z")

</div>

Yeah, to follow up, @JamminR. I updated to High Sierra, and the system python isn’t even linked to OpenSSL, it’s LibreSSL 2.2.7 now. But the Plex scanning is still broken just the same. I’d be happy to be wrong, but I’m pretty sure this needs to be fixed in Plex’s libraries.

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [March 26, 2018, 9:56pm UTC](https://forums.plex.tv/t/https-broken/216635/8 "2018-03-26T21:56:56Z")

</div>

I’ve never understood the error completely. I know it has something to do with new versions of Python/urllib trying to verify the security certificates (older versions of Python/urllib did not do this).  
I only know of some workarounds.

1. Do not verify certificates. A bit like how older Python versions worked:

- [Import ssl and urllib2](https://github.com/plexinc-plugins/ABC.bundle/blob/736b66937f0a2f8a6f8a9379ea27bd62bfe89f34/Contents/Code/ __init__.py#L1 "Import ssl and urllib2")
- [Use urllib2 with a default ssl context](https://github.com/plexinc-plugins/ABC.bundle/blob/736b66937f0a2f8a6f8a9379ea27bd62bfe89f34/Contents/Code/ __init__.py#L123-L133 "Use urllib2 with a default ssl context") (which does not verify the certificate).

Or:  
2. Use external Python libraries

- Add [those libraries](https://github.com/piplongrun/muvio.bundle/tree/c859f420361e01e480410647aaabb6ddc713aeaa/Contents/Libraries/Shared "those libraries") to your project bundle and use them.
- [Set PlexPluginCodePolicy to Elevated in Info.plist](https://github.com/piplongrun/muvio.bundle/blob/c859f420361e01e480410647aaabb6ddc713aeaa/Contents/Info.plist#L11-L12 "Set PlexPluginCodePolicy to Elevated in Info.plist")
- [Import certifi and requests into your Python code](https://github.com/piplongrun/muvio.bundle/blob/c859f420361e01e480410647aaabb6ddc713aeaa/Contents/Code/ __init__.py#L1-L2 "Import certifi and requests into your Python code")
- [Use requests in your code](https://github.com/piplongrun/muvio.bundle/blob/c859f420361e01e480410647aaabb6ddc713aeaa/Contents/Code/ __init__.py#L68 "Use requests in your code")

---

<div class="post-metadata">

**Author:** ![ddn](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ddn/32/87158_2.png) [@ddn](https://forums.plex.tv/u/ddn)\
**Post date:** [March 26, 2018, 11:59pm UTC](https://forums.plex.tv/t/https-broken/216635/9 "2018-03-26T23:59:21Z")

</div>

@sander1 super helpful, thank you. Your guide to adding external libraries was perfect, and I was able to fix this scanner.

Ironically though, now all the metadata is correct but the artwork display, most likely because the Plex internals still use the libraries with broken SNI! :s

Same problem as your solution #1. It’s fine to not verify certificates, unless the server on the other end refuses to handshake if you don’t pass servername. So, basically, Plex still needs to fix this.

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [March 27, 2018, 4:42pm UTC](https://forums.plex.tv/t/https-broken/216635/10 "2018-03-27T16:42:30Z")

</div>

@ddn Can I see your scanner and/or metadata code somewhere online? Or are we talking about the default Plex scanner(s) and agent(s)?

---

<div class="post-metadata">

**Author:** ![ddn](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ddn/32/87158_2.png) [@ddn](https://forums.plex.tv/u/ddn)\
**Post date:** [March 27, 2018, 4:59pm UTC](https://forums.plex.tv/t/https-broken/216635/11 "2018-03-27T16:59:16Z")

</div>

@sander1 I ported the scanner code to requests, and now it works perfectly. You can see the original code here though [https://github.com/mmmmmtasty/SportScanner](https://github.com/mmmmmtasty/SportScanner)

That said, it’s still fundamentally broken because Plex then internally tries to download the art that is on an HTTPS URL and fails.

i.e.: com.plexapp.system.log.3:URLError: urlopen error [SSL: SSLV3\_ALERT\_HANDSHAKE\_FAILURE] sslv3 alert handshake failure (\_ssl.c:590)

This needs to be fixed in Plex, it’s ridiculous that it’s still broken many years after SNI was fixed in python.

---

<div class="post-metadata">

**Author:** ![ddn](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ddn/32/87158_2.png) [@ddn](https://forums.plex.tv/u/ddn)\
**Post date:** [March 12, 2019, 8:19pm UTC](https://forums.plex.tv/t/https-broken/216635/12 "2019-03-12T20:19:34Z")

</div>

This is STILL broken ☹

On Linux AND OSX, probably on Windows too.

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [March 13, 2019, 12:55am UTC](https://forums.plex.tv/t/https-broken/216635/13 "2019-03-13T00:55:08Z")

</div>

Yep, and with plugins going away there isn’t going to be a fix. If you still need to write/update Plex plugins, use one of the workarounds listed earlier in this thread.

---

<div class="post-metadata">

**Author:** ![ddn](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ddn/32/87158_2.png) [@ddn](https://forums.plex.tv/u/ddn)\
**Post date:** [March 13, 2019, 1:28pm UTC](https://forums.plex.tv/t/https-broken/216635/14 "2019-03-13T13:28:45Z")

</div>

Is there an update later than this one?

## Will scanners and agents be affected?

While support for browsable plugins is being discontinued, nothing is happening to scanners and metadata agents with this announcement.

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [March 13, 2019, 1:57pm UTC](https://forums.plex.tv/t/https-broken/216635/15 "2019-03-13T13:57:41Z")

</div>

Nope, that’s the last announcement, but since “browsable plugins” and agents run on the same framework, the ssl issues are exactly the same.

---

<div class="post-metadata">

**Author:** ![jarias14](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jarias14](https://forums.plex.tv/u/jarias14)\
**Post date:** [May 27, 2019, 9:57pm UTC](https://forums.plex.tv/t/https-broken/216635/16 "2019-05-27T21:57:43Z")

</div>

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](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](https://www.thesportsdb.com)”, “[http://localhost:8006](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.

---

<div class="post-metadata">

**Author:** ![ddn](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ddn/32/87158_2.png) [@ddn](https://forums.plex.tv/u/ddn)\
**Post date:** [May 27, 2019, 11:11pm UTC](https://forums.plex.tv/t/https-broken/216635/17 "2019-05-27T23:11:47Z")

</div>

I created a proxy as well but this solution sucks.

And apparently it will never be fixed, because they’re taking away plugins.

All in all I’m glad I’ve never paid for Plex, and don’t plan to.

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [May 28, 2019, 3:51pm UTC](https://forums.plex.tv/t/https-broken/216635/18 "2019-05-28T15:51:56Z")

</div>

Another “solution” is to include the Python `requests` library and use that to handle http requests.

---

<div class="post-metadata">

**Author:** ![jarias14](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jarias14](https://forums.plex.tv/u/jarias14)\
**Post date:** [May 30, 2019, 1:03pm UTC](https://forums.plex.tv/t/https-broken/216635/19 "2019-05-30T13:03:37Z")

</div>

Wouldn’t that be overwritten once I update Plex?

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [May 31, 2019, 3:43pm UTC](https://forums.plex.tv/t/https-broken/216635/20 "2019-05-31T15:43:24Z")

</div>

No, because you include them in your plugin bundle, not in a part of Plex. See my [earlier post](https://forums.plex.tv/t/https-broken/216635/8) for a bit more info.

[Next page](https://forums.plex.tv/t/https-broken/216635.md?page=2)
