diff --git a/REFERENCE.md b/REFERENCE.md index 9d796abe3..630e0c278 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -815,7 +815,7 @@ Default value: `'1.1'` ##### `gzip_proxied` -Data type: `Nginx::GzipProxied` +Data type: `Variant[Nginx::GzipProxied, Array[Nginx::GzipProxied]]` diff --git a/manifests/init.pp b/manifests/init.pp index e63cf5ce9..2445c100d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -112,7 +112,7 @@ String $gzip_disable = 'msie6', Integer $gzip_min_length = 20, Variant[Enum['1.0','1.1'], Float] $gzip_http_version = '1.1', - Nginx::GzipProxied $gzip_proxied = 'off', + Variant[Nginx::GzipProxied, Array[Nginx::GzipProxied]] $gzip_proxied = 'off', Optional[Variant[String[1],Array[String[1]]]] $gzip_types = undef, Enum['on', 'off'] $gzip_vary = 'off', Optional[Enum['on', 'off', 'always']] $gzip_static = undef, diff --git a/spec/classes/nginx_spec.rb b/spec/classes/nginx_spec.rb index ae70a3f08..716290775 100644 --- a/spec/classes/nginx_spec.rb +++ b/spec/classes/nginx_spec.rb @@ -1554,6 +1554,22 @@ end end + context 'when gzip is non-default (on) set gzip_proxied' do + let(:params) { { gzip: 'on' } } + + context 'set gzip_proxied to a single value' do + let(:params) { super().merge({ gzip_proxied: 'any' }) } + + it { is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(%r{ gzip_proxied any;}) } + end + + context 'set gzip_proxied to multiple values' do + let(:params) { super().merge({ gzip_proxied: %w[no-cache expired] }) } + + it { is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(%r{ gzip_proxied no-cache expired;}) } + end + end + context 'when gzip_static is non-default set gzip_static' do let(:params) do { diff --git a/templates/conf.d/nginx.conf.erb b/templates/conf.d/nginx.conf.erb index 435ed6658..5fa31c3c9 100644 --- a/templates/conf.d/nginx.conf.erb +++ b/templates/conf.d/nginx.conf.erb @@ -166,7 +166,7 @@ http { gzip_min_length <%= @gzip_min_length %>; gzip_http_version <%= @gzip_http_version %>; <% if @gzip_proxied -%> - gzip_proxied <%= @gzip_proxied %>; + gzip_proxied <%= Array(@gzip_proxied).uniq.join(' ') %>; <% end -%> <% if @gzip_types -%> gzip_types <%= @gzip_types.kind_of?(Array) ? @gzip_types.join(' ') : @gzip_types %>; diff --git a/templates/streamhost/streamhost.erb b/templates/streamhost/streamhost.erb index 75bc48ee0..e9549c42b 100644 --- a/templates/streamhost/streamhost.erb +++ b/templates/streamhost/streamhost.erb @@ -9,7 +9,7 @@ server { <%- end -%> <%# check to see if ipv6 support exists in the kernel before applying -%> <%# FIXME this logic is duplicated all over the place -%> -<%- if @ipv6_enable && (defined? @ipaddress6) -%> +<%- if @ipv6_enable && (defined? @facts.fetch('networking', {})['ip6']) -%> <%- if @ipv6_listen_ip.is_a?(Array) then -%> <%- @ipv6_listen_ip.each do |ipv6| -%> listen [<%= ipv6 %>]:<%= @ipv6_listen_port %> <% if @ipv6_listen_options %><%= @ipv6_listen_options %><% end %>;