]> gitweb.fluxo.info Git - puppet-apache.git/commitdiff
Adding remote_addr parameter
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 26 May 2013 23:44:02 +0000 (20:44 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 26 May 2013 23:44:02 +0000 (20:44 -0300)
manifests/init.pp

index 1c4d24f19e4aec69ec7d9188e28dc00ede3cbe52..d90b5bc2987064d424403e277b7a13ae1f8d3393 100644 (file)
@@ -37,6 +37,7 @@ class apache(
   $default_folder = '/var/www/data',
   $server_name    = $hostname,
   $https_proxy    = 'no'
+  $remote_addr    = false,
 ) {
 
   include ssl
@@ -165,6 +166,20 @@ class apache(
     notify  => Service["apache"],
   }
 
+  # remote addr rewrite
+  # see http://stackoverflow.com/questions/2328225/how-to-set-remote-addr-in-apache-before-php-is-invoked
+  file { "$conf_d/remote-addr":
+    ensure => $remote_addr ? {
+      false   => absent,
+      default => present,
+    },
+    content => "RequestHeader set REMOTE_ADDR ${remote_addr}\n",
+    owner   => root,
+    group   => root,
+    mode    => 0644,
+    notify  => Service["apache"],
+  }
+
   # Notify this when apache needs a reload. This is only needed when
   # sites are added or removed, since a full restart then would be
   # a waste of time. When the module-config changes, a force-reload is