Configure Subsonic to be behind an Apache 2.4 proxy

Tutorials, tips and tricks.

Moderator: moderators

Configure Subsonic to be behind an Apache 2.4 proxy

Postby DaveWut » Fri Sep 26, 2014 5:47 pm

Since version 5, I went on a particular problem with my current setup of my Apache2 proxy. When I was trying to play videos, Subsonic would use a local URL instead of my domain name and wouldn't use the HTTPS protocol. To fix this problem, we need to change two particular settings in order to make it work correctly again.

First of all, open your Subsonic Virtual Host configuration on the server hosting Apache2. In your proxy configuration section, please add these lines:
Code: Select all
     ProxyRequests Off
     ProxyPreserveHost on
     SSLProxyEngine On
     SSLProxyVerify none
     SSLProxyCheckPeerCN off
     SSLProxyCheckPeerExpire off
     SSLProxyCheckPeerName off


These lines tells Apache2 to ignore the SSL validation of Subsonic (which is invalid by default). Additionally it will preserve the host information, so that subsonic won't use the local URL while using the video player.

The second thing you need to do is to enable HTTPS on subsonic. To do that, open the configuration file on your system, then replace the SUBSONIC_ARGS line with something like this:
Code: Select all
SUBSONIC_ARGS="--max-memory=512 --port=4041 --https-port=4040"

Make SURE to set the "port" argument if you use 4040 for HTTPS.

In your Apache2 proxy setting, make sure the local HTTPS URL is used.
Example:
Code: Select all
     ProxyPass / https://mylocalhostname:4040/
     ProxyPassReverse / https://mylocalhostname:4040/


If you guys want a well explained tutorial of how to make a complete configuration, I will make it if people ask for it. I hope this helps for the other!
Dave

EDIT: Since someone mentioned it, some configuration of Apache only work with version 2.4.5 or later.
Last edited by DaveWut on Wed Oct 01, 2014 2:11 pm, edited 1 time in total.
User avatar
DaveWut
 
Posts: 57
Joined: Fri Nov 11, 2011 12:29 am

Re: Configure Subsonic to be behind an Apache2 proxy

Postby jimmyface » Mon Sep 29, 2014 4:52 pm

Thanks for this write up! The "ProxyPreserveHost on" option worked beautifully for me.

Sadly, my webserver is running apache 2.2, so I couldn't get the video streams to go over HTTPS. It turns out that the SSLProxyCheckPeerName directive is only supported on Apache 2.4.5 or later. If you try to use that argument on an earlier version you get the error message "Invalid command 'SSLProxyCheckPeerName', perhaps misspelled or defined by a module not included in the server configuration"

For those of us on older versions of apache, the only option you need to add to your configuration is "ProxyPreserveHost On" and then video streams will work, albeit not over HTTPS.
jimmyface
 
Posts: 1
Joined: Mon Sep 29, 2014 4:42 pm

Re: Configure Subsonic to be behind an Apache2 proxy

Postby DaveWut » Wed Oct 01, 2014 2:10 pm

My bad, I never though of the Apache version. I often run top of the line versions of software at home, because I like to try new features. If you happen to have Ubuntu Server, upgrade to the latest version (14.04 LTS) and you'll be able have the features of Apache 2.4. Well otherwise, it had been a pleasure to help you find out your problem! :)
User avatar
DaveWut
 
Posts: 57
Joined: Fri Nov 11, 2011 12:29 am

Re: Configure Subsonic to be behind an Apache 2.4 proxy

Postby blightzero » Fri Oct 10, 2014 12:54 pm

Thank you DaveWut, for your posting.
While this is a work around for the HTTPS redirection problem it is not really a nice solution.
I have a setup with multiple virtual machines on a Server, one machine running nginx as a webserver, one of the other machines runs the subsonic server. This setup will result in a situation where the subsonic host will encrypt the traffic, the webserver then decrypts the traffic, then again encrypts the traffic and sends it to the browser of the user. This adds an overhead of two en/decryption steps that are entirely useless and is therefore in my opinion not the ideal solution.
blightzero
 
Posts: 12
Joined: Sat Jan 30, 2010 2:27 pm

Re: Configure Subsonic to be behind an Apache 2.4 proxy

Postby Exrace » Sat Jan 24, 2015 2:13 pm

I use a Sophos UTM firewall for my redirection and it works well.
I have this setup all running on vmware.
See this related post.
viewtopic.php?f=5&t=15096&p=65801#p65801
Exrace
 
Posts: 218
Joined: Thu Nov 11, 2010 5:02 am


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 6 guests