Skip to content

Commit 774844a

Browse files
Robert Marshallstanhu
andcommitted
Merge branch 'sh-drop-http-version-health-check' into 'master'
Set proxy_http_version v1.0 for health monitoring endpoints See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/7068 Merged-by: Robert Marshall <[email protected]> Approved-by: Robert Marshall <[email protected]> Reviewed-by: Clemens Beck <[email protected]> Co-authored-by: Stan Hu <[email protected]>
2 parents b162b36 + 0f2eb42 commit 774844a

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

files/gitlab-cookbooks/gitlab/templates/default/nginx-gitlab-health.conf.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ location /error.json {
1515
<% @monitoring_addresses.each do |address| %>
1616
location = <%= File.join(@path, address[:url]) %> {
1717
proxy_cache off;
18-
proxy_http_version 1.1;
18+
proxy_http_version 1.0;
1919
proxy_pass http://gitlab-workhorse;
2020
error_page 404 500 502 /error.<%= address[:format] %>;
2121
}

files/gitlab-cookbooks/gitlab/templates/default/nginx-status.conf.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ server {
3737

3838
location /rails-metrics {
3939
proxy_cache off;
40-
proxy_http_version 1.1;
40+
proxy_http_version 1.0;
4141
proxy_pass http://gitlab-workhorse/-/metrics;
4242
<% @options.each do |key, value|
4343
if value.is_a?(String) -%>

spec/chef/cookbooks/gitlab/recipes/nginx_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@
9494
}
9595
end
9696

97+
let(:metrics_http_conf) do
98+
{
99+
"gitlab-health" => "/var/opt/gitlab/nginx/conf/gitlab-health.conf",
100+
"nginx-status" => "/var/opt/gitlab/nginx/conf/nginx-status.conf"
101+
}
102+
end
103+
97104
before do
98105
allow(Gitlab).to receive(:[]).and_call_original
99106
end
@@ -428,6 +435,14 @@
428435
}
429436
end
430437
end
438+
439+
it 'sets proxy_http_version 1.0 when proxy_pass is used' do
440+
metrics_http_conf.each_value do |conf|
441+
expect(chef_run).to render_file(conf).with_content { |content|
442+
expect(content).to include('proxy_http_version 1.0;') if content.include?('proxy_pass')
443+
}
444+
end
445+
end
431446
end
432447

433448
context 'when is enabled' do

0 commit comments

Comments
 (0)