[Solved] Subsonic Standalone behind Apache ReverseProxy

Need help? Post your questions here.

Moderator: moderators

[Solved] Subsonic Standalone behind Apache ReverseProxy

Postby daily-freak » Mon May 12, 2014 10:25 am

Hello there,

i recently installed the stand-alone version of subsonic on my gentoo-server. Now I have a strange problem I don't understand.

I configured subsonic for http. In addition I use Apache2 as ReverseProxy for the jetty included in subsonic stand alone. This Apache is accessable over the internet, but only with ssl. Below are my configuration-files of subsonic and the relevant parts of the apache.

Now my problem: Generally subsonic is working. Also over the internet/dyndns. But some functions are not working. For example the Settings-Button in the top.view. The link this button leads to is to the "settings.view?".

* If I enter this link "https://my.domain.com/subsonic/settings.view" the response is very slow.
* After some time the URL changes to "http://my.domain.com/subsonic/playerSettings.view". This sort of redirect is done in jetty I think. You notice that https became http. I get a 404.
* If I now manually change the URL from http to https the page is shown

It seems like the redirecting done in jetty leads to a wrong returned URL. And I don't understand why. As I see the configuration should be correct.
If I directly access the jetty in my LAN and bypass the apache everything also works fine. So it must be some thing between the stand alone jetty and the apache. I don't know what to do so any help or suggestions would be much appreciated.

Greetings daily

Edit: The same problem seems to Affect the "More Actions"-Dropdown like Downloading, adding a song to a playlist etc.

subsonic.sh
Code: Select all
SUBSONIC_HOME=/mnt/raid0/subsonic/bin/data
SUBSONIC_HOST=0.0.0.0
SUBSONIC_PORT=8085
SUBSONIC_HTTPS_PORT=0
SUBSONIC_CONTEXT_PATH=/subsonic
SUBSONIC_MAX_MEMORY=150
SUBSONIC_PIDFILE=
SUBSONIC_DEFAULT_MUSIC_FOLDER=/mnt/raid0/subsonic/audio
SUBSONIC_DEFAULT_PODCAST_FOLDER=/mnt/raid0/subsonic/podcasts
SUBSONIC_DEFAULT_PLAYLIST_FOLDER=/mnt/raid0/subsonic/playlists



Virtual-Host
Code: Select all
<IfModule mod_proxy.c>
        ProxyRequests Off
        ProxyVia On
        ProxyPreserveHost On

        <Proxy *>
                AddDefaultCharset off
                Allow from all
        </Proxy>

</IfModule>

<IfDefine SSL>
        <IfDefine SSL_DEFAULT_VHOST>
                <IfModule ssl_module>

                Listen 443
                NameVirtualHost *:443

                </IfModule>
        </IfDefine>
</IfDefine>


ServerAdmin root@myserver
Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
        RewriteEngine On
        RewriteCond %{HTTPS} !on
        RewriteCond %{REQUEST_URI} !^/server-status
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

       <Location /server-status/>
                 SetHandler server-status
                 Order Deny,Allow
                 Deny from all
                 Satisfy Any
                 Allow from 127.0.0.1
                #Allow from All
        </Location>

</VirtualHost>

<IfDefine SSL>
<IfDefine SSL_DEFAULT_VHOST>
<IfModule ssl_module>

<VirtualHost *:443>
        ServerName my.domain.com
        ServerAlias myserver

        SSLEngine on
        SSLProxyEngine on
        SSLCertificateFile /etc/ssl/apache2/my.domain.com.crt
        SSLCertificateKeyFile /etc/ssl/apache2/my.domain.com.key
        SSLOptions StrictRequire
        SSLProtocol all -SSLv2

        DocumentRoot "/var/www/localhost/htdocs"

        FilterProvider gzdeflate DEFLATE Content-Type $text/

      <IfModule mod_fastcgi.c>
           Alias /php5.fastcgi /var/www/fastcgi/php5.fastcgi
           AddHandler php-script .php
           FastCGIExternalServer /var/www/fastcgi/php5.fastcgi -socket /var/run/php-fpm-localhost.sock$

           Action php-script /php5.fastcgi virtual

      # This part is not necessary to get it to work, but it stops anything else from being
      # accessed from it by mistake or maliciously.
           <Directory "/var/www/fastcgi">
                   Order allow,deny
                   <Files "php5.fastcgi">
                           Order deny,allow
                   </Files>
           </Directory>
      </IfModule>

        <IfModule mpm_peruser_module>
                ServerEnvironment apache apache
        </IfModule>

        <IfModule authnz_external_module>
                AddExternalAuth pwauth  /usr/sbin/pwauth
                SetExternalAuthMethod   pwauth  pipe
                AddExternalGroup unixgroup /usr/sbin/unixgroup
                SetExternalGroupMethod unixgroup environment
        </IfModule>

      <Directory "/var/www/localhost/cgi-bin">
                SSLRequireSSL
                Options FollowSymLinks
                Order deny,allow
                Allow from all

                AuthType Basic
                AuthName "This is private"
                AuthBasicProvider external
                AuthExternal pwauth
                GroupExternal unixgroup
                Require user dailyfreak
        </Directory>

        <Directory /var/www/localhost/htdocs>
                SSLRequireSSL
                Options Indexes FollowSymLinks
                #FilterChain +gzdeflate

                Order deny,allow
                Allow from all

                AuthType Basic
                AuthName "This is private"
                AuthBasicProvider external
                AuthExternal pwauth
                GroupExternal unixgroup
                Require user dailyfreak
        </Directory>
         
      <Location /subsonic>
         FilterChain +gzdeflate
         SSLRequireSSL

         Order deny,allow
         Allow from all

         AuthType Basic
         AuthName "This is private"
         AuthBasicProvider external
         AuthExternal pwauth
         GroupExternal unixgroup
         Require user dailyfreak

         ProxyPass http://127.0.0.1:8085/subsonic
         ProxyPassReverse https://my.domain.com/subsonic
      </Location>

</VirtualHost>

</IfModule>
</IfDefine>
</IfDefine>
Last edited by daily-freak on Tue May 13, 2014 8:20 am, edited 1 time in total.
daily-freak
 
Posts: 10
Joined: Mon May 12, 2014 10:03 am

Re: Subsonic Standalone behind Apache ReverseProxy -> Proble

Postby daily-freak » Tue May 13, 2014 6:56 am

I finaly got this working. I simply needed to switch off ProxyPreserveHost in the Apache-Config. After this the problem was solved.

Greetings
daily-freak
 
Posts: 10
Joined: Mon May 12, 2014 10:03 am


Return to Help

Who is online

Users browsing this forum: No registered users and 32 guests