Skip to content

Commit

Permalink
Merge pull request #658 from gujaws/feature_sort_ssl_header
Browse files Browse the repository at this point in the history
sort add_header values for ssl vhost
  • Loading branch information
3flex committed Jul 9, 2015
2 parents c1563a7 + 2032351 commit 9ef5ec1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
18 changes: 18 additions & 0 deletions spec/defines/resource_vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,24 @@
|/)
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
6 changes: 4 additions & 2 deletions templates/vhost/vhost_ssl_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%>

0 comments on commit 9ef5ec1

Please sign in to comment.