PMS behind Apache Proxy

Where to find config file
I would like to use the web interface of Plex behind a proxy/proxyreverse of my Apache server.

It allows me to use only one port and some restrictions for a lot of web applications.

I used to put this in my apache conf :


ProxyPass http://localhost:32400/manage
ProxyPassReverse http://localhost:32400/manage


But for PMS, I need to configure it to use /plexmediaserver as root web url.

Where can I configure this ? And change the default port in the same way ?

Thanks a lot

You could try this:



<br />
<VirtualHost *:80><br />
<br />
ServerName pms<br />
	<br />
RewriteEngine on<br />
RewriteCond %{REQUEST_URI} !^/manage<br />
RewriteRule ^/$ /manage/$1 [R]<br />
<br />
ProxyPass / http://localhost:32400/<br />
ProxyPassReverse / http://localhost:32400/<br />
<br />
ErrorLog  /var/logs/httpd/error_log<br />
CustomLog /var/logs/httpd/access_log combined env=!dontlog<br />
<br />
</VirtualHost><br />
<br />




This works for me. But its just a virtual host.
/Mark


I asked myself the same. I am too stupid to configure apache on my mac. I need to have access on www.mypage.com/plex. Didn't work so far. The solution here is working if I access it on www.mypage.com, but that's not what I want. How can we configure the web root of PMS?

Thanks


I still didn't find any solutions. The ZiGGiMoN's one seems to be only when you have a dedicated webpage for PMS, not appropriate for my case.


I think I really need to change the web root of PMS. Anyone ?


It's not possible, PMS is not a real web server, just a API that happen to work over http. I don't understand why a apache rewrite rule wouldn't work for you.

Maybe I didn’t use the apache rewrite rules correctly.

In my conf, I have other proxy pass for some services (like sabnzbd for example).

And my webroot (www.mydomain.tld) is used for my website. It’s why I configure my apache to use mydomain.tld/service/ for each services I have. For those services, I just have to proxypass to the localhost:port of the service and to define a new web root for the service.



But maybe I’m wrong in my conf, I’m not really good with apache conf.



Yeah, same here! And I manged to get it working somehow once over root, but just to find out that there are even other URLs to rewrite. Cannot remember, I think it wanted to access "/scripts/...". I gave up then as I already didn't knew why it was working... :-)

My theory is. If the /manage interface isnt a true webserver, it would explain why you cant do a simple alias + proxy to the interface. Having a lot of variable content from various locations is an impossible structure for apache proxy module to handle. Alias/Location work against the design of the proxypass module. And requires a section such as: proxypass /location !

You can redirect eg /yourlocation/manage via proxypass but it can’t predict the API requests that the manage interface returns via the proxy. So the interface from the browser will request content at eg /library/…content… And that path is not working for the Alias/Location tag. Some hardcore rewrite rule writing by someone very familiar to the interface might work around this. But far from a simple task.



I did manage to get the basic frame to appear but not the content. Didn’t have time to play around a lot with rewriting. The whole thing will work with vhost because proxying is based on / and forward. So all /library /manage and so on requests will work.



Anyone up for a lot of tracing and rewriting? (and hardcore regex) :slight_smile:



/Mark



More thoughts on this is more than welcome.



I think it's exactly this problem. But no idea for the solution.

Hardcore rewrite rules using more hardcore regex would be my guess :slight_smile:



/Mark


I tried, but didn't get it. It is really a shame that PMS cannot be stuck behind a reverse proxy easily... :-(

My workaround for now is to use the direct link to the menagement interface when going through myPlex. But there I am asked for a password, but my “myPlex” password is not working?!? What password do I need there? Somebody knows it?



Edit

This is the url I use: http://MyServerIp:19117/manage/index.html.

One problem with this for me is also, that it is not over https. :frowning:

Edit

Hi Guys,



I found the following workaround, which is at least working to have access to the manager:


<br />
<Location /manage><br />
    ProxyPass http://localhost:32400/manage<br />
    ProxyPassReverse http://localhost:32400/manage<br />
</Location><br />
<Location /library><br />
    ProxyPass http://localhost:32400/library<br />
    ProxyPassReverse http://localhost:32400/library<br />
</Location><br />
<Location /photo><br />
    ProxyPass http://localhost:32400/photo<br />
    ProxyPassReverse http://localhost:32400/photo<br />
</Location><br />




I still get some errors in apache for some access to /system or /security but at least i have what i need: access to manager, browse, view images and descriptions, do update :roll eyes:

In fact adding /system allows to update descriptions/fix incorrect match, for security i have no idea right now

A dedicated vhost with a proxypass setting for / should solve it. It would proxy all URLs including /security, and make it work.



It’s the only way I have found to make all things work. Because the webinterface is made up of more than just html traffic.



/Mark

we should ask developers to put a prefix (like /plex or something like that) to make all this easier. I cannot create a complete vhost as i have other stuff running to.



The way the tech works currently a /plex prefix wouldn't be possible, bc the UI fetches data vi the same API as clients to too.

If you have DNS control of you domain, and are not running any SSL specific stuff, its always possible to create a vhost. In apache you just have to reconfigure your config to have a default site, and then enable namebased vhosts, and create a pms.yourdomain.com vhost. That should work fine. I have many sites and vhosts on my apache. All working fine.

/Mark

With the most recent version of plex, here are the added items that are needed to make it work. Hope others may find it useful.

ProxyPass http://localhost:32400/web
ProxyPassReverse http://localhost:32400/web

<Location /system>
ProxyPass http://localhost:32400/system
ProxyPassReverse http://localhost:32400/system

<Location /servers>
ProxyPass http://localhost:32400/servers
ProxyPassReverse http://localhost:32400/servers

<Location /accounts>
ProxyPass http://localhost:32400/accounts
ProxyPassReverse http://localhost:32400/accounts

<Location /myplex>
ProxyPass http://localhost:32400/myplex
ProxyPassReverse http://localhost:32400/myplex

<Location /photo>
ProxyPass http://localhost:32400/photo
ProxyPassReverse http://localhost:32400/photo

<Location /clients>
ProxyPass http://localhost:32400/clients
ProxyPassReverse http://localhost:32400/clients

Thanks Ananke, that’s nice.



One more question, all my apps are running through a proxy on my site, but is it possible to make the http://...:11193/web/ tunneled to https? I think it should be possible in the same way with port 32400 (for managing) because i don’t want al my users able to manage my server. On the other hand i don’t want an unsecured connection to my server with http. I use my domain ***.info, which tunnels everything through https.



In summary, i need a solution to make a proxy for port 11193, like the one for 32400.

Has anyone gotten this to work properly yet?

I'm trying to make Plex accesible from a subdomain but a piece of the url is simply vanishing.

http://forums.plexapp.com/index.php/topic/67156-plex-access-via-subdomain/

I got it to work with Ananke's changes. Thanks!