logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Reverse Proxy and Subsonic streamer
Author
ajssbp



Joined: 02 Apr 2022
Posts: 2
Location: Grand Rapids

PostPosted: Sat 02 Apr '22 16:21    Post subject: Reverse Proxy and Subsonic streamer Reply with quote

Hello,

I've been using subsonic as a self-hosted music streaming service for years. Subsonic runs on mysite:4040. I can change it to any port above 1024. My workplace recently blocked all ports but port 80. I attempted to set up a reverse proxy in Apache 2.4.18, and it kind of works, but not fully. I'm missing something. This is what is in my .conf file:

Code:

<VirtualHost *:80>
ProxyRequests Off
ProxyPreserveHost On

ProxyPass /subsonic/ http://127.0.0.1:4040/
ProxyPassReverse /subsonic/ http://127.0.0.1:4040/
</VirtualHost>


If I navigate to mysite/subsonic/ I get a Not Found error from apache. It IS passing data though - when I normally navigate to mysite:4040 it redirects to a 4040/login.view, and when I go to my /subsonic/ link it ALSO gives the login.view, but gives mysite/login.view NOT mysite/subsonic/login.view like I would expect.

When further testing, if I login to subsonic on another tab using the mysite:4040 link and go to the /subsonic/ page it starts to load the site, but is missing all the images and the actual player. I feel like I'm close, but I've got something missing somewhere. Any help would be appreciated. Thanks.
Back to top
ajssbp



Joined: 02 Apr 2022
Posts: 2
Location: Grand Rapids

PostPosted: Sat 02 Apr '22 19:53    Post subject: Reply with quote

Further testing - I changed the proxy settings so instead of rerouting /subsonic to localhost:4040 it routes / to localhost:4040. Now it proxies perfectly.

I can't leave it this way because I then can't access my wordpress page that actually lives on port 80, but I guess it shows something...... Thoughts?
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 305
Location: UK

PostPosted: Mon 04 Apr '22 13:14    Post subject: Reply with quote

If you can only have the one Apache listener on port 80, and you need the bulk of that site for Wordpress, then you'll have to configure Subsonic to use a single URI context, e.g. /subsonic. The following worked for me in a test VM.

a) In the Subsonic Control Panel, under Settings, set the context path to /subsonic.

b) In your Apache configuration, replace your current Proxy directives with the following Location block.
Code:

# Apply enclosed directives only to matching location.
#
<Location /subsonic>

    # Edit location response headers to be site relative.
    #
    Header edit Location http://(.*):4040/subsonic/(.*) /subsonic/$2

    # Proxy requests for /subsonic context.
    #
    ProxyPass                  http://127.0.0.1:4040/subsonic
    ProxyPassReverse           http://127.0.0.1:4040/subsonic
</Location>

Note the entry to edit location response headers, to remove the unwanted port reference.
Back to top


Reply to topic   Topic: Reverse Proxy and Subsonic streamer View previous topic :: View next topic
Post new topic   Forum Index -> Apache