diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-05-23 15:07:42 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-05-23 15:07:42 +0000 |
commit | 9459f8fad296bea99dd9bccabb337a2dc3bdb4a8 (patch) | |
tree | 04ba704ec7186858100856b6868c3f5bb5af7cc0 /modules | |
parent | c82d2d6bb1571c3f9058e8c52fa83831cfbea360 (diff) | |
download | puppet-9459f8fad296bea99dd9bccabb337a2dc3bdb4a8.tar puppet-9459f8fad296bea99dd9bccabb337a2dc3bdb4a8.tar.gz puppet-9459f8fad296bea99dd9bccabb337a2dc3bdb4a8.tar.bz2 puppet-9459f8fad296bea99dd9bccabb337a2dc3bdb4a8.tar.xz puppet-9459f8fad296bea99dd9bccabb337a2dc3bdb4a8.zip |
apache: add option to select default redirect URL
Add an option to change the URL to redirect to in case of unknown vhost.
If the option is not provided, a 404 error is returned.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/apache/manifests/var.pp | 5 | ||||
-rw-r--r-- | modules/apache/templates/00_default_vhosts.conf | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/modules/apache/manifests/var.pp b/modules/apache/manifests/var.pp index 294af458..2c33a23f 100644 --- a/modules/apache/manifests/var.pp +++ b/modules/apache/manifests/var.pp @@ -1,9 +1,12 @@ # $httpdlogs_rotate: # number of time the log file are rotated before being removed +# $default_vhost_redirect: +# URL to redirect to in case of unknown vhost class apache::var( $httpdlogs_rotate = '24', $apache_user = 'apache', - $apache_group = 'apache' + $apache_group = 'apache', + $default_vhost_redirect = '' ) { if ($::lsbdistrelease == '1') or ($::lsbdistid == 'MandrivaLinux') { $pkg_conf = 'apache-conf' diff --git a/modules/apache/templates/00_default_vhosts.conf b/modules/apache/templates/00_default_vhosts.conf index a1afe9ca..9a5f586c 100644 --- a/modules/apache/templates/00_default_vhosts.conf +++ b/modules/apache/templates/00_default_vhosts.conf @@ -3,5 +3,13 @@ <Location /> Allow from all </Location> - Redirect / http://www.<%= @domain %>/ + <%- + default_redirect = scope.lookupvar('apache::var::default_vhost_redirect') + if default_redirect == '' + -%> + Redirect 404 / + ErrorDocument 404 "Page Not Found" + <%- else -%> + Redirect / <%= default_redirect %> + <%- end -%> </VirtualHost> |