Skip to content

Commit

Permalink
Merge pull request #2161 from chef/rajeshpaul38/hide-nginx-server-hea…
Browse files Browse the repository at this point in the history
…der-from-response

Hide nginx server header from response
  • Loading branch information
tas50 authored Aug 18, 2021
2 parents 06e5df6 + 3359189 commit 75e982b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion omnibus/config/software/supermarket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

dependency "cacerts"
dependency "git"
dependency "nginx"
dependency "openresty"
dependency "postgresql"
dependency "redis"
dependency "ruby"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ http {
<% end %>

server_tokens off;
more_clear_headers Server;
add_header X-Clacks-Overhead "GNU Terry Pratchett";

sendfile <%= @nginx['sendfile'] %>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
describe "http GET to Port #{property['supermarket']['nginx']['non_ssl_port']}" do
subject { http("http://localhost:#{property['supermarket']['nginx']['non_ssl_port']}") }
it 'should not include server version number in response headers' do
expect(subject.headers.server).to cmp('nginx')
expect(subject.headers.server).to be_nil
end
end

Expand All @@ -97,7 +97,7 @@

describe http("https://#{property['supermarket']['fqdn']}:#{property['supermarket']['nginx']['ssl_port']}", ssl_verify: false) do
it 'should not include server version number in response headers' do
expect(subject.headers.server).to cmp('nginx')
expect(subject.headers.server).to be_nil
end

its('headers.keys') { should include('strict-transport-security') }
Expand Down

0 comments on commit 75e982b

Please sign in to comment.