proxy_set_headers for other nginx config
This commit is contained in:
parent
010c8540a9
commit
c2722f1e86
|
@ -923,6 +923,12 @@ default['gitlab']['mattermost-nginx']['proxy_set_headers'] = {
|
|||
####
|
||||
default['gitlab']['pages-nginx'] = default['gitlab']['nginx'].dup
|
||||
default['gitlab']['pages-nginx']['enable'] = true
|
||||
default['gitlab']['pages-nginx']['proxy_set_headers'] = {
|
||||
"Host" => "$http_host",
|
||||
"X-Real-IP" => "$remote_addr",
|
||||
"X-Forwarded-For" => "$proxy_add_x_forwarded_for",
|
||||
"X-Forwarded-Proto" => "$scheme"
|
||||
}
|
||||
|
||||
####
|
||||
# GitLab Registry NGINX
|
||||
|
@ -934,5 +940,5 @@ default['gitlab']['registry-nginx']['proxy_set_headers'] = {
|
|||
"Host" => "$http_host",
|
||||
"X-Real-IP" => "$remote_addr",
|
||||
"X-Forwarded-For" => "$proxy_add_x_forwarded_for",
|
||||
"X-Forwarded-Proto" => "$scheme"
|
||||
"X-Forwarded-Proto" => "$scheme"
|
||||
}
|
||||
|
|
|
@ -61,10 +61,11 @@ server {
|
|||
|
||||
# Pass everything to pages daemon
|
||||
location / {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
<% @proxy_set_headers.each do |header| %>
|
||||
<% next if header[1].nil? %>
|
||||
proxy_set_header <%= header[0] %> <%= header[1] %>;
|
||||
<% end %>
|
||||
|
||||
proxy_pass http://<%= @pages_listen_proxy %>;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ describe 'nginx' do
|
|||
"Upgrade" => "$http_upgrade",
|
||||
"Connection" => "$connection_upgrade"
|
||||
}))
|
||||
expect(chef_run.node['gitlab']['pages-nginx']['proxy_set_headers']).to eql(basic_nginx_headers)
|
||||
end
|
||||
|
||||
it 'supports overriding default nginx headers' do
|
||||
|
@ -137,6 +138,11 @@ describe 'nginx' do
|
|||
"Upgrade" => "$http_upgrade",
|
||||
"Connection" => "$connection_upgrade"
|
||||
}))
|
||||
|
||||
expect(chef_run.node['gitlab']['pages-nginx']['proxy_set_headers']).to eql(nginx_headers({
|
||||
"X-Forwarded-Proto" => "https",
|
||||
"X-Forwarded-Ssl" => "on"
|
||||
}))
|
||||
end
|
||||
|
||||
it 'supports overriding default nginx headers' do
|
||||
|
@ -144,12 +150,14 @@ describe 'nginx' do
|
|||
stub_gitlab_rb(
|
||||
"nginx" => { proxy_set_headers: { "Host" => "nohost.example.com", "X-Forwarded-Proto" => "ftp" } },
|
||||
"mattermost_nginx" => { proxy_set_headers: { "Host" => "nohost.example.com", "X-Forwarded-Proto" => "ftp" } },
|
||||
"registry_nginx" => { proxy_set_headers: { "Host" => "nohost.example.com", "X-Forwarded-Proto" => "ftp" } }
|
||||
"registry_nginx" => { proxy_set_headers: { "Host" => "nohost.example.com", "X-Forwarded-Proto" => "ftp" } },
|
||||
"pages_nginx" => { proxy_set_headers: { "Host" => "nohost.example.com", "X-Forwarded-Proto" => "ftp" } }
|
||||
)
|
||||
|
||||
expect(chef_run.node['gitlab']['nginx']['proxy_set_headers']).to include(expect_headers)
|
||||
expect(chef_run.node['gitlab']['mattermost-nginx']['proxy_set_headers']).to include(expect_headers)
|
||||
expect(chef_run.node['gitlab']['registry-nginx']['proxy_set_headers']).to include(expect_headers)
|
||||
expect(chef_run.node['gitlab']['pages-nginx']['proxy_set_headers']).to include(expect_headers)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue