Add support for RewriteRules and Redirect

tags/0.2.3
Daniel Berteaud 13 years ago
parent 86568ddcd3
commit fe557a66db
  1. 19
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/50Content
  2. 5
      smeserver-webapps-common.spec

@ -1,16 +1,35 @@
{ {
my $target = $domain->prop('ProxyPassTarget') || ''; my $target = $domain->prop('ProxyPassTarget') || '';
my $redirect = $domain->prop('Redirect') || '';
my $rewrite = $domain->prop('Rewrite') || '';
my $allow = $domain->prop('AllowHosts') || ''; my $allow = $domain->prop('AllowHosts') || '';
my $preserve = $domain->prop('ProxyPreserveHost') || 'no'; my $preserve = $domain->prop('ProxyPreserveHost') || 'no';
my $keepalive = $domain->prop('ProxyNoKeepAlive') || 'no'; my $keepalive = $domain->prop('ProxyNoKeepAlive') || 'no';
# ProxyPass ?
if ($target =~ m|https?://[\d\w\.\-/]*|){ if ($target =~ m|https?://[\d\w\.\-/]*|){
$OUT .= " SetEnv proxy-nokeepalive 1\n" if ($keepalive eq 'yes'); $OUT .= " SetEnv proxy-nokeepalive 1\n" if ($keepalive eq 'yes');
$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 .= " 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{ else{
my $root = $domain->prop('DocumentRoot') || my $root = $domain->prop('DocumentRoot') ||
'/home/e-smith/files/ibays/Primary/html'; '/home/e-smith/files/ibays/Primary/html';

@ -5,7 +5,7 @@
Summary: Common WebApps Framework for SME Server Summary: Common WebApps Framework for SME Server
%define name smeserver-webapps-common %define name smeserver-webapps-common
Name: %{name} Name: %{name}
%define version 0.2.1 %define version 0.2.2
%define release 1 %define release 1
Version: %{version} Version: %{version}
Release: %{release}%{?dist} Release: %{release}%{?dist}
@ -29,6 +29,9 @@ This package provide common files and events for Web Applications integration
on SME Server on SME Server
%changelog %changelog
* Tue Mar 13 2012 Daniel Berteaud <daniel@firewall-services.com> 0.2.2-1.sme
- Add support for RewriteRule or Redirect
* Tue Mar 13 2012 Daniel Berteaud <daniel@firewall-services.com> 0.2.1-1.sme * Tue Mar 13 2012 Daniel Berteaud <daniel@firewall-services.com> 0.2.1-1.sme
- Add ServerAlias support in WebAppVirtualHost - Add ServerAlias support in WebAppVirtualHost

Loading…
Cancel
Save