Wrapping Subsonic in Proxy for HTTP Basic Authentication

Tutorials, tips and tricks.

Moderator: moderators

Wrapping Subsonic in Proxy for HTTP Basic Authentication

Postby bigfatpaulyj » Mon Oct 03, 2011 10:47 pm

Just thought i'd post about this issue here since it took me a while to figure out how to sort the issue. My ISP (UPC - Ireland) seems to block http servers which do not use http basic authentication. The reasoning being that their internet service is only meant to be for private use... I was running subsonic and each time i'd move the server to a new port and within a few hours they'd have it blocked again. So i figured it might solve the problem if there was a http proxy which requires basic authentication. And it seems to have worked. Here's how i managed to set things up on Ubuntu 11, the same solution should work on other systems too though...

First install Apache2 if not already installed:
sudo apt-get install apache2

Then create a password file with user credentials that match what your Subsonic account login is.
sudo mkdir /etc/apache2/passwd
sudo htpasswd /etc/apache2/passwd/passwords <new user>

Now enable the 'proxy' and 'proxy_http' modules in apache:
sudo a2enmod proxy
sudo a2enmod proxy_http

Now edit the proxy module config file:
/etc/apache2/mods-enabled/proxy.conf
Here's my one which routes localhost:80/subsonic to http://localhost:8087/subsonic:
----
<IfModule mod_proxy.c>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /subsonic http://localhost:8087/subsonic
ProxyPassReverse /subsonic http://localhost:8087/subsonic
ProxyVia On

<Location /subsonic>
AuthType Basic
AuthName Demo-Access
AuthUserFile /etc/apache2/passwd/passwords
Require valid-user
</Location>

</IfModule>
----

Now restart Apache:
sudo /etc/init.d/apache2 restart

This should get the proxy part working. Now you just have to ensure that the Subsonic server is running on the correct port and context path. Edit your subsonic config file:
/etc/default/subsonic

Here's what mine looks like:
---
SUBSONIC_ARGS="--max-memory=100 --port=8087 --context-path=/subsonic"
SUBSONIC_USER=root
---

And that should do the trick. The solution won't fix things if you use the 3rd Party iSub app. But it does seem to work for the official Android app and for people who use the service through a web browser.
bigfatpaulyj
 
Posts: 5
Joined: Wed Jun 22, 2011 1:09 pm

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 10 guests