Bruno Tavares faf9d932ba Fix proxy and redirect configuration file names.
While working on puppet-lodgeit acceptance tests we found that the
configuration file that `httpd::mod::proxy` creates was not being picked
up by Apache because it was missing the prefix `.conf`. This transition
is required to configure httpd modules correctly on Apache >= 2.4

To prevent Apache from loading two the same configuration twice, we
remove the file without extension, so this change does not affect
running systems.

This change has fixes for `httpd::mod::proxy` and `httpd::mod::redirect`
as they have the same issue. We added tests as well to increase the
confidence on the fix.

The acceptance will be fixed on the follow-up patch, as the redirect
grants are broken for 2.4 as well.

Change-Id: I82241038d687316f91f18209fe8323c12422e2f8
Co-Authored-By: Danilo Ramalho <dramalho@thoughtworks.com>
2015-10-19 15:43:51 -02:00

63 lines
1.3 KiB
Puppet

# Define: httpd::vhost::proxy
#
# Configures an apache vhost that will only proxy requests
#
# Parameters:
# * $port:
# The port on which the vhost will respond
# * $dest:
# URI that the requests will be proxied for
# - $priority
# - $template -- the template to use for the vhost
# - $vhost_name - the name to use for the vhost, defaults to '*'
#
# Actions:
# * Install Apache Virtual Host
#
# Requires:
#
# Sample Usage:
#
define httpd::vhost::proxy (
$port,
$dest,
$priority = '10',
$template = 'httpd/vhost-proxy.conf.erb',
$servername = undef,
$serveraliases = undef,
$ssl = false,
$vhost_name = '*'
) {
include ::httpd
$apache_name = $httpd::params::apache_name
$ssl_path = $httpd::params::ssl_path
if $servername == undef {
$srvname = $name
} else {
$srvname = $servername
}
if $ssl == true {
include ::httpd::ssl
}
file { "${priority}-${name}":
ensure => absent,
path => "${httpd::params::vdir}/${priority}-${name}",
}
file { "${priority}-${name}.conf":
path => "${httpd::params::vdir}/${priority}-${name}.conf",
content => template($template),
owner => 'root',
group => 'root',
mode => '0755',
require => Package['httpd'],
notify => Service['httpd'],
}
}