Allow custom ProxyPass rules on domains

tags/0.3.2_1_el6 0.3.2_1_el6
Daniel Berteaud 7 years ago
parent c30e43f6cd
commit aff38fdd3e
  1. 16
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/50Content

@ -20,6 +20,18 @@ my @groups = split(/[;,]/, ($domain->prop('AllowGroups') || ''));
my $ssl_port = $modSSL{'TCPPort'} || '443'; my $ssl_port = $modSSL{'TCPPort'} || '443';
my $proto = ($port eq $ssl_port ) ? 'https' : 'http'; my $proto = ($port eq $ssl_port ) ? 'https' : 'http';
my $socketio = $domain->prop('ProxySocketIO') || 'disabled'; my $socketio = $domain->prop('ProxySocketIO') || 'disabled';
my @proxyrules = split /[,;]/, ($domain->prop('ProxyPassRules') || '');
# Custom proxypass rules
foreach my $rule (@proxyrules){
my ($from, $to) = split /=/, $rule;
$OUT .= " ProxyPass $from $to\n";
}
if (@proxyrules > 0 || $target =~ m|https?://[\d\w\.\-/]*|){
$OUT .= " ProxyPreserveHost on\n" if ($preserve eq 'yes');
$OUT .= " RequestHeader set X-Forwarded-Proto \"$proto\"\n";
}
# ProxyPass ? # ProxyPass ?
if ($target =~ m|https?://[\d\w\.\-/]*|){ if ($target =~ m|https?://[\d\w\.\-/]*|){
@ -51,12 +63,10 @@ if ($target =~ m|https?://[\d\w\.\-/]*|){
</IfModule> </IfModule>
_EOF _EOF
} }
$OUT .= " ProxyPass / $target\n"; $OUT .= " ProxyPass / $target\n";
$OUT .= " ProxyPassReverse / $target\n"; $OUT .= " ProxyPassReverse / $target\n";
} }
$OUT .= " ProxyPreserveHost on\n" if ($preserve eq 'yes');
$OUT .= " RequestHeader set X-Forwarded-Proto \"$proto\"\n";
} }
# Rewrite ? # Rewrite ?
elsif ($rewrite =~ m|https?://[\d\w\.\-/]*|){ elsif ($rewrite =~ m|https?://[\d\w\.\-/]*|){

Loading…
Cancel
Save