Grant access for vhosts on Apache >= 2.4

Apache's configuration for access control has changed on 2.4. To allow
access to served directories we need to include the new directive
"Require grant all".

We scoped the configuration to only be applied on Apache 2.4. More
information can be viewed on the Apache's upgrade document[1].

The tests were changed to ensure that the configuration is working
without any extra override, as the extra test vhost is on a custom
directory that requires the template to grant access to it.

[1] http://httpd.apache.org/docs/trunk/upgrading.html

Change-Id: I898ca049c5b3592cb70ad8c22eba8d4c681f3b22
Co-Authored-By: Bruno Tavares <btavare@thoughtworks.com>
This commit is contained in:
Danilo Ramalho 2015-09-28 17:13:14 -03:00 committed by Bruno Tavares
parent faf9d932ba
commit bf7ce40e2f
3 changed files with 6 additions and 6 deletions

View File

@ -13,12 +13,6 @@ httpd::vhost { 'localhost':
# Enable a secondary port to test proxy and redirect modules
$override = '
Listen 8080
<Directory "/html">
Options All
AllowOverride All
Require all granted
Allow from all
</Directory>
'
file { "${::httpd::params::vdir}override.conf":
content => $override,

View File

@ -18,6 +18,9 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
Order allow,deny
allow from all
Satisfy any
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>
ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_error.log
LogLevel warn

View File

@ -15,6 +15,9 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
<Proxy *>
Order deny,allow
Allow from all
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Proxy>
ProxyPass / <%= @dest %>/
ProxyPassReverse / <%= @dest %>/