Subsonic reverse proxy issue

General discussions.

Moderator: moderators

Subsonic reverse proxy issue

Postby ajssbp » Sat Apr 02, 2022 2:20 pm

Hello,

I've been a long time subsonic user, over a decade. My workplace recently decided to block any ports other than 80, so I can no longer access my subsonic server at mysite:4040. I've set up a reverse proxy in Apache so mysite/subsonic routes to mysite:4040. The login pages don't work though and I get a 404 error. While testing this at home, if I'm already logged in on another tab and go to mysite/subsonic the page partially loads, but no images and no player. But the data is there. I feel like I'm close, but not quite there.

This is what I have set in my apache .conf file:
Code: Select all
ProxyRequests Off
ProxyPreserveHost On

ProxyPass /subsonic/ http://127.0.0.1:4040/
ProxyPassReverse /subsonic/ http://127.0.0.1:4040/


Any suggestions would be appreciated. Thanks.
ajssbp
 
Posts: 4
Joined: Sun Jun 17, 2012 9:58 pm

Re: Subsonic reverse proxy issue

Postby acroyear » Sat Apr 02, 2022 4:37 pm

Might need to add a Location block? This is mine (minus the lets-encrypt security cert):
Code: Select all
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://localhost:4040/
    ProxyPassReverse / http://localhost:4040/
    <Location />
        Order allow,deny
        Allow from all
    </Location>


Mind you, mine is redirecting based on virtual hosting (a cname setting at my ISP).

Not sure what it would look like without the virtual hosting settings as a wrapper.
--
Joe Shelby
http://subfiresuite.com/
http://subfireplayer.net/
User avatar
acroyear
 
Posts: 779
Joined: Wed Mar 27, 2013 8:05 pm
Location: Northern, VA

Re: Subsonic reverse proxy issue

Postby ajssbp » Sat Apr 02, 2022 5:43 pm

I added the location block, no change in behavior.

Full virtualhost section of the .conf is as follows:

Code: Select all
<VirtualHost *:80>

ProxyRequests Off
ProxyPreserveHost On

ProxyPass /subsonic http://localhost:4040
ProxyPassReverse /subsonic http://localhost:4040

<Location /subsonic>
        Order allow,deny
        Allow from all
</Location>

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

</VirtualHost>


I'm frankly stumped. Seems like this should be working



Edit -

New wrinkle - just for giggles I changed the proxy from /subsonic to just /. That worked perfectly. Subsonic loads, runs, can login, etc. Now the downside obviously is I lose my wordpress site located at the domain usually. Now I'm even more stumped as to what's going on! Proxypass seems to be working right, but something about how I'm trying to do the subsite/folder isn't working right.......
ajssbp
 
Posts: 4
Joined: Sun Jun 17, 2012 9:58 pm

Re: Subsonic reverse proxy issue

Postby acroyear » Sun Apr 03, 2022 2:00 am

try /subsonic/ - maybe the point is having the ending / attached to it, which the / version obviously does?
--
Joe Shelby
http://subfiresuite.com/
http://subfireplayer.net/
User avatar
acroyear
 
Posts: 779
Joined: Wed Mar 27, 2013 8:05 pm
Location: Northern, VA

Re: Subsonic reverse proxy issue

Postby ajssbp » Sun Apr 03, 2022 6:57 pm

Doing /subsonic/ instead of /subsonic results in the same behavior as previous - login page gives a page does not exist error, but if logged in on another tab get partial loading. Flipped it back to / and it works again. This is odd....
ajssbp
 
Posts: 4
Joined: Sun Jun 17, 2012 9:58 pm

Re: Subsonic reverse proxy issue

Postby djdonnerwolke » Wed Aug 17, 2022 8:48 pm

Are the problems still current?
I use Nginx in a Docker container and if you need the configuration, I can give it to you. In the backend, however, I still use the TomCat web server.
Everyone thinks they are, except me: I am!
User avatar
djdonnerwolke
 
Posts: 7
Joined: Sun Apr 18, 2021 11:51 am
Location: GERMANY

Re: Subsonic reverse proxy issue

Postby djdonnerwolke » Wed Aug 17, 2022 8:58 pm

In my NGINX Docker I have the following configuration:

Code: Select all
# ------------------------------------------------------------
# subsonic.domain.de
# ------------------------------------------------------------


server {
  set $forward_scheme https;
  set $server         "10.0.1.111";
  set $port           4443;

  listen 80;
listen [::]:80;

listen 443 ssl http2;
listen [::]:443 ssl http2;


  server_name subsonic.domain.de;


  # Let's Encrypt SSL
  include conf.d/include/letsencrypt-acme-challenge.conf;
  include conf.d/include/ssl-ciphers.conf;
  ssl_certificate /etc/letsencrypt/live/npm-19/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/npm-19/privkey.pem;












    # Force SSL
    include conf.d/include/force-ssl.conf;




proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;


  access_log /data/logs/proxy-host-19_access.log proxy;
  error_log /data/logs/proxy-host-19_error.log warn;

   location ~ \.php$ {
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;

        proxy_pass   http://10.0.1.114:80;
    }





  location / {

   







   
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_http_version 1.1;
   

    # Proxy!
    include conf.d/include/proxy.conf;
  }


  # Custom
  include /data/nginx/custom/server_proxy[.]conf;
}



Image

Image

On my subsonic Server I have the following in the
Code: Select all
/etc/default/subsonic


Code: Select all
SUBSONIC_ARGS="--max-memory=150 --https-port=4443 --db=jdbc:mysql://10.0.1.118:3306/subsonic?user=subsonic&password=PASSWORD&characterEncoding=UTF-8"


I can use this to call up my Subsonic via port 80/443.
I hope I could help you a little with this.

EDIT:
If you want to ask me why I forward the request internally to port 4443:
The Subsonic needs a secure connection when calling the settings. I cannot provide the secure connection on port 4040 if I use a Lets Encrypt certificate.
Everyone thinks they are, except me: I am!
User avatar
djdonnerwolke
 
Posts: 7
Joined: Sun Apr 18, 2021 11:51 am
Location: GERMANY


Return to General

Who is online

Users browsing this forum: No registered users and 9 guests