Defined Type: apache::reverse_proxy

Defined in:
puppet/modules/apache/manifests/reverse_proxy.pp

Overview

Define: apache::reverse_proxy

Creates a reverse proxy for an internal port. Using reverse proxies avoids conflicts when multiple vagrant boxes with the same service role are running. So e.g. if the service listens on port 1234, instead of using localhost:1234 or dev.wiki.local.wmftest.net:1234 on the host machine (which could result in a port redirection conflict) or using <guest ip>:1234 (inconvenient) one can just use <alias>.local.wmftest.net:<standard vagrant port>, with different boxes using different ports.

Parameters

port

Internal port used by the service. All requests sent to the proxy will be redirected here.

hostname

Domain name prefix. E.g. 'restbase' will result in the service being reachable at restbase.local.wmftest.net:<port> (where <port> is whatever was set via `vagrant config http_port`). Defaults to the resource name.

headers

Custom headers to override the real response headers with. Can be used e.g. to allow CORS. Should be formatted as a hash of header name => value.

Examples

apache::reverse_proxy { 'restbase':
    port => 8888,
}

Parameters:

  • port (Any)
  • hostname (Any) (defaults to: $title)
  • headers (Any) (defaults to: {})


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'puppet/modules/apache/manifests/reverse_proxy.pp', line 34

define apache::reverse_proxy(
    $port,
    $hostname = $title,
    $headers = {},
) {
    include apache::mod::proxy
    include apache::mod::proxy_http
    include apache::mod::headers
    include ::mwv
    $base_domain = $::mwv::tld

    apache::site { $hostname:
        ensure  => present,
        content => template('apache/reverse_proxy.erb'),
        require => [
            Class['::apache::mod::proxy'],
            Class['::apache::mod::proxy_http'],
            Class['::apache::mod::headers'],
        ],
    }
}