mescon / Muximux

A lightweight way to manage your HTPC
GNU General Public License v2.0
1.14k stars 82 forks source link

Plex wont work via Muximux #58

Closed yeyeoke closed 8 years ago

yeyeoke commented 8 years ago

A couple of days ago Plex stopped working inside of Muximux, it works fine when navigating directly to: "localhost:32400/web/index.html#" but when I try to use the same adress in a tab for Muximux it just shows a blank white page. It worked fine last week and I've made no changes on the server.

mescon commented 8 years ago

That's because the Plex webserver (app.plex.tv/web) was updated a couple of days ago, and they are now sending a strict Content Security Policy. This in itself is nothing that Muximux can change or do some clever trick to fix.

I have reported this behaviour to Plex and asked them to implement a "whitelisting" function or an option to disable the behaviour in the same way that Emby Media Server has done this with their DenyIframeEmbedding = false directive.

In the meantime, the only thing you can do is to install a plugin that tells your browser to simply ignore any Content-Security-Policy settings that websites try to set (though that is typically bad to do). If you use a Chromium based browser (such as Google Chrome, Chromium, Opera or SRWare Iron), you simply install this plugin: https://chrome.google.com/webstore/detail/ignore-x-frame-headers/gleekbfjekiniecknbkamfmkohkpodhe and it works!

I don't personally use Firefox (Opera all the way, yay!), but I suspect something similar exists for it - a quick google gave me this, though perhaps there are easier alternatives if you're not comfortable with it: https://addons.mozilla.org/sv-SE/firefox/addon/moz-rewrite-json/

If you use Internet Explorer or NSAMicrosoft Edge, then all hope is lost.

yeyeoke commented 8 years ago

Okay, too bad. It isnt that important really I'll just have to live without it. Tried to install the plugin, restarted xampp and chrome but that still doesnt work. Lets hope plex implements the whitelist function!

mescon commented 8 years ago

Weird, because thats the plugin I use - just install and restart webbrowser and it started working.

SaskiFX commented 7 years ago

I found an alternate solution for this, and thought I would post it here. I reverse proxy my stuff with nginx, and for basic Plex work, this fixed it for me. (Not sure about playing media files.)

Reverse proxy Plex with the instructions at: https://www.htpcguides.com/configure-plex-media-server-reverse-proxy-nginx-linux/

Add the following to the location block: proxy_set_header X-Frame-Options "";

That way it strips out the setting Plex added that prevents Muximux from loading it up.

pun-private commented 7 years ago

Hi everyone,

I have found a workaround ! Proof: https://imgur.com/a/bpUwY

You cannot use directly plex.tv/web or http://your_ip:32400/ in Muximux because of the X-FRAME-OPTIONS. (nothing new here)

However, if you use one of the domains created by plex.tv to connect back to your plex server, it works perfectly ! These URL looks like this : https://XXX-YYY-ZZZ-223.*censored*b5e37.plex.direct:32400 If you add the public URL, to Muximux, it should work (if you are home, check that your router is able to do NAT loopback)

To find this URL, there are two ways:

  1. Login into plex.tv/web and watch the traffic using chrome debugger for example
  2. You should see requests which domains looks similar to the URL above

EXTRA: Your plex server domains are stored in https://plex.tv/api/resources?includeHttps=1&includeRelay=1&X-Plex-Token=*your_plex_tv_token*

It returns an xml file with all the domains to connect to your plex (if you are home, outside, etc):

<MediaContainer size="7">
    <Device name="MY-PLEX" product="Plex Media Server" productVersion="1.5.3.3580-4b377d295" platform="Linux" platformVersion="4.2.8 (#1 SMP Tue May 16 01:15:55 CST 2017)" device="PC" clientIdentifier="*censored" createdAt="1475947029" lastSeenAt="1497512452" provides="server" owned="1" accessToken="*censored*" publicAddress="WW.XX.YY.ZZ" httpsRequired="1" synced="0" relay="1" publicAddressMatches="0" presence="1">
        <Connection protocol="https" address="192.168.1.25" port="32400" uri="https://192-168-1-25.*censored*.plex.direct:32400" local="1"/>
        <Connection protocol="https" address="10.0.5.1" port="32400" uri="https://10-0-5-1.*censored*.plex.direct:32400" local="1"/>
        <Connection protocol="https" address="10.0.3.1" port="32400" uri="https://10-0-3-1.*censored*.plex.direct:32400" local="1"/>
        <Connection protocol="https" address="XXX-YYY-ZZZ-223" port="32400" uri="https://XXX-YYY-ZZZ-223.*censored*b5e37.plex.direct:32400" local="0"/>
        <Connection protocol="https" address="85.90.246.82" port="8443" uri="https://85-90-246-82.*censored*.plex.direct:8443" local="0" relay="1"/>
    </Device>
</MediaContainer>