Skip to content

Commit

Permalink
Avoid Optional[Array] = undef in remoteip.conf.erb
Browse files Browse the repository at this point in the history
By defaulting to an empty array and handling that the code is
simplified.
  • Loading branch information
ekohl committed Jan 2, 2024
1 parent 4b316af commit 9f9f32c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions templates/mod/remoteip.conf.epp
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<%- |
String $header,
Optional[Array[Stdlib::Host]] $internal_proxy = undef,
Array[Stdlib::Host] $internal_proxy = [],
Optional[Stdlib::Absolutepath] $internal_proxy_list = undef,
Optional[String] $proxies_header = undef,
Boolean $proxy_protocol = undef,
Optional[Array[Stdlib::Host]] $proxy_protocol_exceptions = undef,
Optional[Array[Stdlib::IP::Address]] $trusted_proxy = undef,
Array[Stdlib::Host] $proxy_protocol_exceptions = [],
Array[Stdlib::IP::Address] $trusted_proxy = [],
Optional[Stdlib::Absolutepath] $trusted_proxy_list = undef,
| -%>
# Declare the header field which should be parsed for useragent IP addresses
RemoteIPHeader <%= $header %>

<%- if $internal_proxy { -%>
<%- unless $internal_proxy.empty { -%>
# Declare client intranet IP addresses trusted to present
# the RemoteIPHeader value
<%- $internal_proxy.each |$proxy| { -%>
Expand All @@ -32,13 +32,11 @@ RemoteIPProxiesHeader <%= $proxies_header %>
RemoteIPProxyProtocol On
<%- } -%>

<%- if $proxy_protocol_exceptions { -%>
<%- $proxy_protocol_exceptions.each |$exception| { -%>
<%- $proxy_protocol_exceptions.each |$exception| { -%>
RemoteIPProxyProtocolExceptions <%= $exception %>
<%- } -%>
<%- } -%>

<%- if $trusted_proxy { -%>
<%- unless $trusted_proxy.empty { -%>
# Declare client intranet IP addresses trusted to present
# the RemoteIPHeader value
<%- $trusted_proxy.each |$proxy| { -%>
Expand Down

0 comments on commit 9f9f32c

Please sign in to comment.