UMS with Apache2 and ProxyPass problem

For help and support with Universal Media Server
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
Post Reply
Umbertones
Posts: 5
Joined: Mon Sep 25, 2023 3:47 am

UMS with Apache2 and ProxyPass problem

Post by Umbertones »

Hi there,

just found out about UMS and instantly liked it as web-based streaming tool.

While it works fine in my local network (thank to some hints I found here in the forum)., I'm not able to make it reachable from the outside

I have a LAMP server with UMS running on the same machine.

In my apache conf:

Code: Select all

# Proxy Pass for UMS
ProxyPass /ums/ http://localhost:9001/
ProxyPassReverse /ums/ http://localhost:9001/
I get 404 errors in the inspector of my Firefox

Code: Select all

https://myoutsideurl/static/css/main.c80fe9c2.css [HTTP/1.1 404 Not Found 4ms] 
and the like for the javascript file.
The same error appears in the access.log of the apache2 webserver

I get the same errors when I replace localhost by the internal IP address of the server.

When I put the ProxyPass for ums in a "Location"-Tab I get a 400 Bad request.

I have been using this ProxyPass stuff for years for different sites on this machine (mostly raspberrys or virtual machines) but never redirecting it to a port on the same machine.

What am I missing here? Many thanks in advance.
User avatar
mik_s
Moderator
Posts: 1130
Joined: Wed Aug 23, 2017 11:03 pm
Location: UK

Re: UMS with Apache2 and ProxyPass problem

Post by mik_s »

UMS was made for streaming on the internal network but it is possible to make it accessible to the outside network but support for that is limited.
I know little about networking but do know that you will need to forward the ports that UMS uses. I can't remember all of them but at least 5001, 9001 (webUI), 9002 (Web player only), and probably some others.

I can only suggest searching the forum to see if someone has made a guide on how they did it, or give you some hints.
Logs are important for us to help, Please follow This Link before asking for support. Just a forum cleaner, Will help if I can but no expert.
boss
Posts: 348
Joined: Thu Jun 30, 2016 1:07 pm

Re: UMS with Apache2 and ProxyPass problem

Post by boss »

I am running UMS on a Gentoo Linux server,
It runs completely outside of Apache and needs no Apache configuration whatsover.

For local use it is just:
IP address of computer hosting UMS:9002 for the media content.
IP address of computer hosting UMS:9001 for configuration.

From outside your lan, you need to port forward to these ports on the IP of the UMS hosting computer as well as a port forward to port 5001.

Then from outside your lan to access UMS:
YourPublicIP:9002 for the media content.
YourPublicIP:9001 for configuration.
Umbertones
Posts: 5
Joined: Mon Sep 25, 2023 3:47 am

Re: UMS with Apache2 and ProxyPass problem

Post by Umbertones »

Thanks for the infos.

For security reasons I would prefer not to open up the ports to the outside but rather use the service via the proxy redirects. So apache is just the intermediate here to the UMS webservice.

But if this fails I have to go with the port configuration.
Umbertones
Posts: 5
Joined: Mon Sep 25, 2023 3:47 am

Re: UMS with Apache2 and ProxyPass problem

Post by Umbertones »

Ok,

after looking at the error messages in the inspector I had an idea.

And indeed, it is working:

Inside apache.conf in the VirtualHost area for the 443 https port

Code: Select all

# Proxy Pass fuer UMS
ProxyPass /ums/  http://localhost:9001/
ProxyPassReverse /ums/  http://localhost:9001/
ProxyPass /static  http://localhost:9001/static
ProxyPassReverse /static  http://localhost:9001/static
ProxyPass /v1  http://localhost:9001/v1
ProxyPassReverse /v1  http://localhost/v1
ProxyPass /player  http://localhost:9001/player
ProxyPassReverse /player  http://localhost:9001/player
Of course this is a rude hack and may fail when stuff changes within UMS, but for a start I'm happy now. :-)
User avatar
mik_s
Moderator
Posts: 1130
Joined: Wed Aug 23, 2017 11:03 pm
Location: UK

Re: UMS with Apache2 and ProxyPass problem

Post by mik_s »

Glad you got it working.

One of the reasons there is not much support for this is because it opens ports to the outside so there is always that extra risk with this. If this keeps things secure then it might be the best way.

There have been a few people wanting to do this but I don't think there is a good guide on setting it up.
Would you be able to make one as I have no idea about this or know anything about proxypass?
Logs are important for us to help, Please follow This Link before asking for support. Just a forum cleaner, Will help if I can but no expert.
Umbertones
Posts: 5
Joined: Mon Sep 25, 2023 3:47 am

Re: UMS with Apache2 and ProxyPass problem

Post by Umbertones »

mik_s wrote: Tue Sep 26, 2023 4:46 pm One of the reasons there is not much support for this is because it opens ports to the outside so there is always that extra risk with this.
I did it with proxy pass, so I had not open ports on my router to the outside.
Of course you can now look specifically for /player to check the existance of an UMS installation directly, that's why I had preferred to keep the whole ums behind a named link, but I have no idea how to do this for now. Apache is a very mighty tool with lots of ways to solve a problem and I'm only scratching it. :-)
There have been a few people wanting to do this but I don't think there is a good guide on setting it up.
Would you be able to make one as I have no idea about this or know anything about proxypass?
Sure, I can give it a try.

If you have a machine running an apache web server, there are configuration files (on linux they are normally located in /etc/apache2):

There you find a directory names sites-enabled where are the configurations for the handling of https-requests, in my case it's named 000-default-le-ssl.conf (note the ssl for the https-requests)

Inside this text file you should find one or more <VirtualHost *:443> tags. Choose the one that handles the ServerName you want to set up the proxy pass.

Then add lines inside the VirtualHost-Tag:

Code: Select all

SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ProxyPreserveHost off

# Proxy Pass fuer UMS
ProxyPass /ums/  http://localhost:9001/
ProxyPassReverse /ums/  http://localhost:9001/
ProxyPass /static  http://localhost:9001/static
ProxyPassReverse /static  http://localhost:9001/static
ProxyPass /v1  http://localhost:9001/v1
ProxyPassReverse /v1  http://localhost/v1
ProxyPass /player  http://localhost:9001/player
ProxyPassReverse /player  http://localhost:9001/player
Save the .conf file and restart your apache server (Linux: sudo systemctl restart apache2) and check whether it worked.

This is the bare minimum to get going and it has one advantage: you can not access the UMS configuraton pages from the outside because these directories are not handled by the proxy which is some kind of security add on. You have to be in the local network of the UMS installation to do this.

@mik_s: is it that what you suggested?
User avatar
mik_s
Moderator
Posts: 1130
Joined: Wed Aug 23, 2017 11:03 pm
Location: UK

Re: UMS with Apache2 and ProxyPass problem

Post by mik_s »

I was thinking more of a guide for someone who knows next to nothing about linux or networking (like me) to have step by step instruction on how to set it up.

For example I don't know what proxypass is. I have set up Octoprint on an old laptop for my 3D printer and I remember one of the steps was setting up HAProxy to make it accessible to the outside (not that I enabled that function). I'm guessing proxy pass is something similar.
I just about know what Apache is as I attempted to make a website a long time ago for a friend, you mentioned LAMP which I assume is the equivalent to WAMP that I used at the time.

This may be enough to point those with some knowledge in the right direction though.


Do you know of a way to do this in windows too?
Logs are important for us to help, Please follow This Link before asking for support. Just a forum cleaner, Will help if I can but no expert.
Umbertones
Posts: 5
Joined: Mon Sep 25, 2023 3:47 am

Re: UMS with Apache2 and ProxyPass problem

Post by Umbertones »

Hmm, it's pretty hard to find the correct level of detail when you know nothing about the knowledge of the other side. From boredom to overcharging is sometimes a small step. -:-)

Yes, WAMP is the Windows equivalent of a Linux LAMP (Linux (OS), Apache (Webserver), Mysql (Database), Php (Programming Language for web content))

The Proxypass handling should be the same on Apache for Windows since they use the same config files. But I haven't used Apache on Windows for a long time, so I'm not perfectly sure about that.

Some information to Proxypass is on the apache docu site
https://httpd.apache.org/docs/2.4/howto ... proxy.html
Post Reply