Browse Source

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>
master
Danilo Ramalho 3 years ago
parent
commit
bf7ce40e2f

+ 0
- 6
spec/acceptance/fixtures/default.pp View File

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

+ 3
- 0
templates/vhost-default.conf.erb View File

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

+ 3
- 0
templates/vhost-proxy.conf.erb View File

@@ -15,6 +15,9 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
15 15
    <Proxy *>
16 16
      Order deny,allow
17 17
      Allow from all
18
+    <IfVersion >= 2.4>
19
+      Require all granted
20
+    </IfVersion>
18 21
    </Proxy>
19 22
    ProxyPass        / <%= @dest %>/
20 23
    ProxyPassReverse / <%= @dest %>/

Loading…
Cancel
Save