66 lines
1.4 KiB
Plaintext
66 lines
1.4 KiB
Plaintext
{
|
|
|
|
my $target = $domain->prop('ProxyPassTarget') || '';
|
|
my $redirect = $domain->prop('Redirect') || '';
|
|
my $rewrite = $domain->prop('Rewrite') || '';
|
|
my $allow = $domain->prop('AllowHosts') || '';
|
|
my $preserve = $domain->prop('ProxyPreserveHost') || 'no';
|
|
my $keepalive = $domain->prop('ProxyNoKeepAlive') || 'no';
|
|
my @env = split(/[;,]/, ($domain->prop('SetEnv') || ''));
|
|
|
|
# ProxyPass ?
|
|
if ($target =~ m|https?://[\d\w\.\-/]*|){
|
|
$OUT .= " SetEnv proxy-nokeepalive 1\n" if ($keepalive eq 'yes');
|
|
$OUT .= " ProxyPass / $target\n";
|
|
$OUT .= " ProxyPassReverse / $target\n";
|
|
$OUT .= " ProxyPreserveHost on\n" if ($preserve eq 'yes');
|
|
}
|
|
# Rewrite ?
|
|
elsif ($rewrite =~ m|https?://[\d\w\.\-/]*|){
|
|
$OUT .=<<"HERE";
|
|
|
|
RewriteRule /(.*|\$) $rewrite/\$1 [L,R]
|
|
|
|
HERE
|
|
}
|
|
# Redirect ?
|
|
elsif ($redirect =~ m|https?://[\d\w\.\-/]*|){
|
|
$OUT .=<<"HERE";
|
|
|
|
RedirectMatch permanent ^/(.*|\$) $redirect/\$1
|
|
|
|
HERE
|
|
}
|
|
else{
|
|
my $root = $domain->prop('DocumentRoot') ||
|
|
'/home/e-smith/files/ibays/Primary/html';
|
|
|
|
$OUT .= " DocumentRoot $root\n";
|
|
}
|
|
|
|
foreach (@env){
|
|
next unless (m/^(.*)=(.*)$/);
|
|
$OUT .= " SetEnv $1 $2\n";
|
|
}
|
|
|
|
if ($allow ne ''){
|
|
if ($allow eq 'local'){
|
|
$allow = "$localAccess $externalSSLAccess";
|
|
}
|
|
else{
|
|
$allow =~ s/[,;]/ /;
|
|
}
|
|
$OUT .=<<"EOF"
|
|
|
|
<Location />
|
|
Order deny,allow
|
|
Deny from all
|
|
Allow from $allow
|
|
</Location>
|
|
|
|
EOF
|
|
}
|
|
|
|
}
|
|
|