Gitlab Pages access control issues a redirect to HTTP even though external URL is set to HTTPS
Summary
When attempting to gain access to a pages domain that is using access control a redirect is issued for a HTTP URL. Our Gitlab instance can't be reached on port 80 at all (we only open 22/443 on the security group) so this times out.
Steps to reproduce
Our Gitlab Pages part of our config looks like this:
pages_external_url 'https://{{ gitlab_pages_host_name }}'
pages_nginx['redirect_http_to_https'] = true
pages_nginx['ssl_certificate'] = "/etc/gitlab/ssl/{{ gitlab_pages_host_name }}.crt"
pages_nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/{{ gitlab_pages_host_name }}.key"
gitlab_pages['access_control'] = true
(we're using Ansible so that's Jinja to allow for a test instance and our production instance).
Looking at the network tab after clicking the "Authorize" button I see:
POST https://gitlab-test.infrastructure-dev.int.cloudnc.com/oauth/authorize => 302 location: https://projects.$gitlab_pages_host_name/auth?code=FOO&state=BAR
followed by
GET https://projects.$gitlab_pages_host_name/auth?code=FOO&state=BAR => 302 location: http://$group_name.$gitlab_pages_host_name/auth?code=FOO&state=BAR
followed by a timeout when requesting the above HTTP URL.
What is the current bug behavior?
A HTTP URL is generated as part of a redirect when using Gitlab Pages access control.
What is the expected correct behavior?
A HTTPS URL should be generated as part of a redirect when using Gitlab Pages access control.
Relevant logs and/or screenshots
See above
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 18.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.5.3p105 Gem Version: 2.7.6 Bundler Version:1.16.6 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.5 Go Version: unknown
GitLab information Version: 11.9.8-ee Revision: c9701808101 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.11 URL: https://REDACTED HTTP Clone URL: https://REDACTED/some-group/some-project.git SSH Clone URL: git@gREDACTED:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: google_oauth2
GitLab Shell Version: 8.7.1 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab subtasks ...Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 8.7.1 ? ... OK (8.7.1) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 3/1 ... yes 3/7 ... yes 3/8 ... yes 30/9 ... yes 3/10 ... yes 2/11 ... yes 3/12 ... yes 3/13 ... yes 3/14 ... yes 3/15 ... yes 3/16 ... yes 3/17 ... yes 3/18 ... yes 3/19 ... yes 3/20 ... yes 3/21 ... yes 3/22 ... yes 3/23 ... yes 30/24 ... yes 3/25 ... yes 3/26 ... yes 3/27 ... yes 30/28 ... yes 3/30 ... yes 3/31 ... yes 3/32 ... yes 5/33 ... yes 10/34 ... yes 30/35 ... yes 3/36 ... yes 3/41 ... yes 30/42 ... yes 3/43 ... yes 10/44 ... yes 3/45 ... yes 3/46 ... yes 10/48 ... yes 10/50 ... yes 2/53 ... yes 2/54 ... yes 10/55 ... yes 15/56 ... yes 15/58 ... yes 3/59 ... yes 3/60 ... yes 3/61 ... yes 3/64 ... yes 16/65 ... yes 3/66 ... yes 30/68 ... yes 10/69 ... yes 11/70 ... yes 3/72 ... yes 18/74 ... yes 30/75 ... yes 10/76 ... yes 5/77 ... yes 16/78 ... yes 18/79 ... yes 3/80 ... yes 18/81 ... yes 19/82 ... yes 13/83 ... yes 13/84 ... yes 11/85 ... yes 15/86 ... yes 15/87 ... yes 15/88 ... yes 3/90 ... yes 16/91 ... yes 3/92 ... yes 3/93 ... yes 16/94 ... yes 30/95 ... yes 3/96 ... yes 16/97 ... yes 10/99 ... yes 3/101 ... yes 10/102 ... yes 18/103 ... yes 6/104 ... yes 3/105 ... yes 3/106 ... yes 3/107 ... yes 3/109 ... yes 3/110 ... yes 3/111 ... yes 10/112 ... yes 16/114 ... yes 10/115 ... yes 30/116 ... yes 2/117 ... yes 23/118 ... yes 3/119 ... yes 3/120 ... yes 3/121 ... yes 30/122 ... yes 16/123 ... yes 19/124 ... yes 13/125 ... yes 3/126 ... yes 3/127 ... yes 10/128 ... yes 10/129 ... yes 25/130 ... yes 25/131 ... yes 25/132 ... yes 16/133 ... yes 18/134 ... yes 11/135 ... yes 10/136 ... yes 2/138 ... yes 3/139 ... yes 30/141 ... yes 3/142 ... yes 13/147 ... yes 28/148 ... yes 28/149 ... yes 13/150 ... yes 19/151 ... yes 28/152 ... yes 28/153 ... yes 13/154 ... yes 13/155 ... yes 10/156 ... yes 11/157 ... yes 3/158 ... yes 13/159 ... yes 10/161 ... yes 13/162 ... yes 30/164 ... yes 13/165 ... yes 10/166 ... yes 3/167 ... yes 30/168 ... yes 30/169 ... yes 3/170 ... yes 30/172 ... yes 10/173 ... yes 10/174 ... yes 30/175 ... yes 3/176 ... yes 3/177 ... yes 28/179 ... yes 16/180 ... yes 10/181 ... yes 30/182 ... yes 30/183 ... yes 30/184 ... yes 31/185 ... yes 30/186 ... yes 38/187 ... yes 11/188 ... yes 14/190 ... yes 3/191 ... yes 13/192 ... yes 3/193 ... yes 13/194 ... yes 31/195 ... yes 31/196 ... yes 30/197 ... yes 30/198 ... yes 30/199 ... yes 3/200 ... yes 3/201 ... yes 26/202 ... yes 10/203 ... yes 28/204 ... yes 26/205 ... yes 26/206 ... yes 27/207 ... yes 26/208 ... yes 26/209 ... yes 10/210 ... yes 10/211 ... yes 10/212 ... yes 3/213 ... yes 3/214 ... yes 25/215 ... yes 31/217 ... yes 2/218 ... yes 25/219 ... yes 13/220 ... yes 2/222 ... yes 3/223 ... yes 3/224 ... yes 10/225 ... yes 3/226 ... yes 19/227 ... yes 14/228 ... yes 18/229 ... yes 3/230 ... yes 3/231 ... yes 3/232 ... yes 26/233 ... yes 33/234 ... yes 26/235 ... yes 18/236 ... yes 36/238 ... yes 34/241 ... yes 3/242 ... yes 28/243 ... yes 32/244 ... yes 32/245 ... yes 38/246 ... yes 2/247 ... yes 26/248 ... yes 26/249 ... yes 26/250 ... yes 13/252 ... yes 5/253 ... yes 13/254 ... yes 34/255 ... yes 10/256 ... yes 14/257 ... yes 31/258 ... yes 16/259 ... yes 3/260 ... yes 2/261 ... yes 14/262 ... yes 13/263 ... yes 13/264 ... yes 10/265 ... yes 5/266 ... yes 3/267 ... yes 14/268 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.5.3) Git version >= 2.18.0 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 22 Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)