# HG changeset patch
# User Ben Bodenmiller <5332-bbodenmiller@users.noreply.gitlab.com>
# Date 1616473883 0
#      Tue Mar 23 04:31:23 2021 +0000
# Node ID b44cc43d3639aba9ff754b3ef86f414a47e83469
# Parent  e31a145a6972bf74de7cd247b759428852c2cc58
Fix use_http2 & redirect_http GitLab Pages settings

Changelog: fixed

diff --git a/changelogs/unreleased/pages-config-fix-5116.yml b/changelogs/unreleased/pages-config-fix-5116.yml
new file mode 100644
--- /dev/null
+++ b/changelogs/unreleased/pages-config-fix-5116.yml
@@ -0,0 +1,5 @@
+---
+title: Fix use_http2 & redirect_http GitLab Pages settings
+merge_request: 5116
+author: Ben Bodenmiller (@bbodenmiller)
+type: fixed
diff --git a/files/gitlab-cookbooks/gitlab-pages/templates/default/gitlab-pages-config.erb b/files/gitlab-cookbooks/gitlab-pages/templates/default/gitlab-pages-config.erb
--- a/files/gitlab-cookbooks/gitlab-pages/templates/default/gitlab-pages-config.erb
+++ b/files/gitlab-cookbooks/gitlab-pages/templates/default/gitlab-pages-config.erb
@@ -63,7 +63,10 @@
 <%-   end -%>
 <%- end -%>
 <%- if @redirect_http-%>
-use-http2=<%= @redirect_http %>
+redirect-http=<%= @redirect_http %>
+<%- end -%>
+<%- if @use_http2-%>
+use-http2=<%= @use_http2 %>
 <%- end -%>
 <%- if @artifacts_server -%>
 <%-   if @artifacts_server_url-%>
diff --git a/spec/chef/gitlab-pages/recipes/gitlab-pages_spec.rb b/spec/chef/gitlab-pages/recipes/gitlab-pages_spec.rb
--- a/spec/chef/gitlab-pages/recipes/gitlab-pages_spec.rb
+++ b/spec/chef/gitlab-pages/recipes/gitlab-pages_spec.rb
@@ -63,6 +63,7 @@
        api-secret-key=/var/opt/gitlab/gitlab-pages/.gitlab_pages_secret
        listen-proxy=localhost:8090
        log-format=json
+       use-http2=true
        artifacts-server=https://gitlab.example.com/api/v4
        artifacts-server-timeout=10
        gitlab-server=https://gitlab.example.com
@@ -253,6 +254,7 @@
             log-verbose
             sentry-dsn=https://b44a0828b72421a6d8e99efd68d44fa8@example.com/40
             sentry-environment=production
+            redirect-http=true
             use-http2=true
             artifacts-server=https://gitlab.elsewhere.com/api/v5
             artifacts-server-timeout=60