Puppet Class: apache::mod::remoteip

Defined in:
manifests/mod/remoteip.pp

Overview

Parameters:

  • header (Any) (defaults to: 'X-Forwarded-For')
  • proxy_ips (Any) (defaults to: [ '127.0.0.1' ])
  • proxies_header (Any) (defaults to: undef)
  • trusted_proxy_ips (Any) (defaults to: undef)
  • apache_version (Any) (defaults to: undef)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'manifests/mod/remoteip.pp', line 1

class apache::mod::remoteip (
  $header            = 'X-Forwarded-For',
  $proxy_ips         = [ '127.0.0.1' ],
  $proxies_header    = undef,
  $trusted_proxy_ips = undef,
  $apache_version    = undef,
) {
  include ::apache
  $_apache_version = pick($apache_version, $apache::apache_version)
  if versioncmp($_apache_version, '2.4') < 0 {
    fail('mod_remoteip is only available in Apache 2.4')
  }

  ::apache::mod { 'remoteip': }

  # Template uses:
  # - $header
  # - $proxy_ips
  # - $proxies_header
  # - $trusted_proxy_ips
  file { 'remoteip.conf':
    ensure  => file,
    path    => "${::apache::mod_dir}/remoteip.conf",
    mode    => $::apache::file_mode,
    content => template('apache/mod/remoteip.conf.erb'),
    require => Exec["mkdir ${::apache::mod_dir}"],
    before  => File[$::apache::mod_dir],
    notify  => Service['httpd'],
  }
}