[Solved] https proxy with apache

Need help? Post your questions here.

Moderator: moderators

[Solved] https proxy with apache

Postby analogue » Wed May 25, 2016 11:06 am

Hello,

I struggle to properly redirect traffic from outside my network to Subsonic when using https. In my network, there is a web server (apache 2.4 with IP 192.168.1.10) that takes all http and https traffic from outside my local network. It is suppose to dispatch the traffic to all other web servers, such has the one which hosts Subsonic, everything works fine but Subsonic.
Here the virtualhost that I use on the web server that redirect all traffic:

Code: Select all
<VirtualHost 192.168.1.10:443>
   ServerAdmin <myemail>
   ServerName subsonic.forumanalogue.fr
   ErrorLog /var/log/apache2/subsonic-error.log
   LogLevel debug
   CustomLog /var/log/apache2/subsonic-access.log combined
   SSLEngine On
   SSLCertificateFile <certfile>
   SSLCertificateKeyFile <keyfile>
   SSLCertificateChainFile <chainfile>
   <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
      RewriteRule .* - [F]
   </IfModule>
   <IfModule mod_rewrite.c>
   <IfModule mod_proxy.c>
      SSLProxyEngine On
      SSLProxyCheckPeerExpire On
      SSLProxyVerifyDepth 10
      ProxyRequests Off
      ProxyPreserveHost On
      ProxyPass / https://subsonic.forumanalogue.fr:443/ keepalive=On retry=5
      ProxyPassReverse / https://subsonic.forumanalogue.fr:443/
      RewriteRule ^/(.*) https://subsonic.forumanalogue.fr/$1 [P,L]
   </IfModule>
   </IfModule>
   <Location />
      Order deny,allow
      Allow from all
   </Location>
</VirtualHost>

<VirtualHost 192.168.1.10:80>
   ServerName subsonic.forumanalogue.fr
   RewriteEngine On
   RewriteCond %{HTTPS} off
   RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301]
   Redirect permanent / https://subsonic.forumanalogue.fr/
</VirtualHost>


It is from a generic template that I use all the time for my other redirections.

When I try to connect, Chromium browser says "subsonic.forumanalogue.fr redirected you too many times.". Here what I get in the logs on the web server at 192.168.1.10
Code: Select all
[Wed May 25 12:58:27.736475 2016] [proxy:debug] [pid 19802] proxy_util.c(1694): AH00925: initializing worker https://subsonic.forumanalogue.fr/ shared
[Wed May 25 12:58:27.736525 2016] [proxy:debug] [pid 19802] proxy_util.c(1734): AH00927: initializing worker https://subsonic.forumanalogue.fr/ local
[Wed May 25 12:58:27.736565 2016] [proxy:debug] [pid 19802] proxy_util.c(1785): AH00931: initialized single connection worker in child 19802 for (subsonic.forumanalogue.fr)

and nothing in subsonic logs on the other server.

Notice that it works fine on local network, i.e. if I access directly to subsonic server, or if I redirect from internet for http only.
Last edited by analogue on Wed Jun 15, 2016 9:36 pm, edited 1 time in total.
analogue
 
Posts: 9
Joined: Wed May 25, 2016 8:04 am

Re: https proxy with apache

Postby analogue » Wed Jun 15, 2016 9:35 pm

Solved. I generated a certificate with Let's encrypt that added an extra vhost to apache. Then the proxy was randomly picking up one of the vhost, leading to this error.
analogue
 
Posts: 9
Joined: Wed May 25, 2016 8:04 am


Return to Help

Who is online

Users browsing this forum: No registered users and 21 guests