sort add_header values for ssl vhost

This commit is contained in:
Christian Groschupp 2015-07-06 13:50:50 +02:00
parent af1f9cad39
commit 203235199b
2 changed files with 22 additions and 2 deletions

View file

@ -956,6 +956,24 @@ describe 'nginx::resource::vhost' do
|/)
end
end
context 'when add_header is set and ssl => true' do
let :params do default_params.merge({
:add_header => { 'header3' => 'test value 3', 'header2' => 'test value 2', 'header1' => 'test value 1' },
:ssl => true,
:ssl_key => 'dummy.key',
:ssl_cert => 'dummy.cert',
}) end
it 'should have correctly ordered entries in the config' do
is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content(/
%r|
\s+add_header\s+header1 test value 1;\n
\s+add_header\s+header2 test value 2;\n
\s+add_header\s+header3 test value 3;\n
|/)
end
end
end
end
end

View file

@ -131,6 +131,8 @@ server {
<% Array(@passenger_env_var).each do |key,value| -%>
passenger_env_var <%= key %> <%= value %>;
<% end -%>
<% Array(@add_header).each do |key,value| -%>
add_header <%= key %> <%= value %>;
<% if @add_header -%>
<%- @add_header.keys.sort.each do |key| -%>
add_header <%= key %> <%= @add_header[key] %>;
<%- end -%>
<% end -%>