{
    # vim: ft=perl:
# proxypass for geneweb and gwsetup

    $haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ?  'yes' : 'no';
    $plainPort = ${'httpd-e-smith'}{TCPPort} || '80';
    $sslPort = ${modSSL}{TCPPort} || '443';

    $OUT = '';
    foreach $place ('geneweb','gwsetup') {
      if ((${$place}{'status'} || 'disabled') eq 'enabled'){
        if (($port eq $plainPort) && ($haveSSL eq 'yes')) {
            $OUT .= '    RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$' . "\n";
            $OUT .= "    RewriteRule ^/$place(/.*|\$)    https://%{HTTP_HOST}/$place\$1 [L,R]\n\n";
        }
        $OUT .= "    ProxyPass /$place/ http://127.0.0.1:${$place}{TCPPort}/\n";
        $OUT .= "    ProxyPassReverse /$place/ http://127.0.0.1:${$place}{TCPPort}/\n";

      } else {
	$OUT .= "    #  $place disabled\n";
      }
    }
}
