Access Control for Gitlab Pages leads to 503 error
Summary
When access control is enabled for Gitlab Pages, going to a page redirects to https://<project>.example.io/auth?...
with a 503 error.
Steps to reproduce
- enable Gitlab Pages running on the same server
- configure a wildcard domain with a certificate and key
- configure
gitlab_pages['inplace_chroot'] = true
as Gitlab is running in an LXC container - enable access control
What is the current bug behavior?
Gitlab Pages apparently authenticates the user but fails to redirect to the desired page.
What is the expected correct behavior?
Authentication should grant access to the documentation page.
Relevant logs and/or screenshots
Only error seen is in /var/log/gitlab/nginx/gitlab_pages_error.log
:
2019/01/28 11:12:04 [error] 2878#0: *180292 connect() failed (111: Connection refused) while connecting to upstream, client: 90.79.150.172, server: ~^(?<group>.*)\.example\.io$, request: "GET /auth?code=2354106a7b50ad457952984322324118a8ddc00ee383acabf309c9bcca1c7e69&state=RoijKifb_BsP1bDn1B2kkA%3D%3D HTTP/2.0", upstream: "http://[::1]:8090/auth?code=2354106a7b50ad457952984322324118a8ddc00ee383acabf309c9bcca1c7e69&state=RoijKifb_BsP1bDn1B2kkA%3D%3D", host: "projects.example.io"
Relevant parts of gitlab.rb
:
pages_external_url 'https://example.io'
##! Set access control based on project membership
gitlab_pages['access_control'] = true
gitlab_pages['listen_proxy'] = "localhost:8090"
##! Environments that do not support bind-mounting should set this parameter to
##! true. This is incompatible with the artifacts server
gitlab_pages['inplace_chroot'] = true
##! HTTPS configuration
pages_nginx['redirect_http_to_https'] = true
pages_nginx['ssl_certificate'] = "/etc/gitlab/ssl/cert.pem"
pages_nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/privkey.pem"
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Debian 9.7 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.3 Go Version: unknownGitLab information Version: 11.7.0-ee Revision: c02f0d4 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.11 URL: https://ninon.canton-consulting.com HTTP Clone URL: https://ninon.canton-consulting.com/some-group/some-project.git SSH Clone URL: git@ninon.canton-consulting.com:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 8.4.4 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks 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.4.4 ? ... OK (8.4.4) 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: ... 1/1 ... yes 1/5 ... yes 1/6 ... yes 22/7 ... yes 6/8 ... yes 6/9 ... yes 6/10 ... yes 6/11 ... yes 6/12 ... yes 6/13 ... yes 6/14 ... yes 6/15 ... yes 6/16 ... yes 6/17 ... yes 6/18 ... yes 6/19 ... yes 6/20 ... yes 6/21 ... yes 6/22 ... yes 6/23 ... yes 6/24 ... yes 6/25 ... yes 6/26 ... yes 6/27 ... yes 6/28 ... yes 6/29 ... yes 6/30 ... yes 6/31 ... yes 6/32 ... yes 6/33 ... yes 22/39 ... yes 12/44 ... yes 12/45 ... yes 12/46 ... yes 12/47 ... yes 22/48 ... yes 13/49 ... yes 6/50 ... yes 6/51 ... yes 10/52 ... yes 11/53 ... yes 6/55 ... yes 17/57 ... yes 20/58 ... yes 16/59 ... yes 23/60 ... yes 16/61 ... 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: ... 13 Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished