{
    # vim: ft=perl:

    $OUT = "";
    # Send any unencrypted attempts to the ssl port.
    if (($port eq "80") && (${'httpd-admin'}{PermitPlainTextAccess} eq 'no'))
    {
        $OUT .= <<'HERE';
    RewriteEngine on

    RewriteRule ^/server-manager   https://%{HTTP_HOST}/server-manager [L,R]
    RewriteRule ^/server-brand     https://%{HTTP_HOST}/server-brand [L,R]
    RewriteRule ^/e-smith-manager  https://%{HTTP_HOST}/e-smith-manager [L,R]
    RewriteRule ^/user-password    https://%{HTTP_HOST}/user-password [L,R]
    RewriteRule ^/e-smith-password https://%{HTTP_HOST}/e-smith-password [L,R]
HERE
    }
    return "    # skipping ProxyPass directives\n" unless $port eq "443"; 

    return "# modSSL disabled" 
        unless (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled");

    #------------------------------------------------------------
    # Proxy Pass directives.
    # The global namespace/directives only cover HTTP based URLs
    # so ProxyPass directives need to be defined inside each
    # SSL enabled VirtualHost directive to allow external SSL
    # access to be ProxyPass'd.
    #------------------------------------------------------------

    $OUT .= << "HERE";

    # ProxyPass executes a module which relays requests to another server
    # We use it to allow transparent access to the admin instance of the
    # web server.

    ProxyPass /server-brand http://127.0.0.1:980/server-brand/
    <Location /server-brand>
        order deny,allow
        deny from all
        allow from $localAccess $externalSSLAccess
    </Location>

    ProxyPass /e-smith-brand http://127.0.0.1:980/e-smith-brand/
    <Location /e-smith-brand>
        order deny,allow
        deny from all
        allow from $localAccess $externalSSLAccess
    </Location>

    # ProxyPass executes a module which relays requests to another server
    # We use it to allow transparent access to the admin instance of the
    # web server.

    ProxyPass /e-smith-common http://127.0.0.1:980/server-common/
    <Location /e-smith-common>
        order deny,allow
        deny from all
        allow from $localAccess $externalSSLAccess
    </Location>

    ProxyPass /server-common http://127.0.0.1:980/server-common/
    <Location /server-common>
        order deny,allow
        deny from all
        allow from $localAccess $externalSSLAccess
    </Location>

    ProxyPass /common http://127.0.0.1:980/common/
    <Location /common>
        order deny,allow
        deny from all
        allow from $localAccess $externalSSLAccess
    </Location>

    # ProxyPass executes a module which relays requests to another server
    # We use it to allow transparent access to the admin instance of the
    # web server.

    ProxyPass /e-smith-manager http://127.0.0.1:980/e-smith-manager/
    <Location /e-smith-manager>
        order deny,allow
        deny from all
        allow from $localAccess $externalSSLAccess
    </Location>

    ProxyPass /server-manager http://127.0.0.1:980/server-manager/
    <Location /server-manager>
        order deny,allow
        deny from all
        allow from $localAccess $externalSSLAccess
    </Location>

    # ProxyPass executes a module which relays requests to another server
    # We use it to allow transparent access to the admin instance of the
    # web server.

    ProxyPass /e-smith-password http://127.0.0.1:980/user-password/
    <Location /e-smith-password>
        order deny,allow
        deny from all
        allow from $localAccess $externalSSLAccess
    </Location>

    ProxyPass /user-password http://127.0.0.1:980/user-password/
    <Location /user-password>
        order deny,allow
        deny from all
        allow from $localAccess $externalSSLAccess
    </Location>

HERE
}
