gitlab pages with access control shows a not valid redirect url
Summary
From a custom server gitlab, when enabling the access control for Gitlab Pages, on every other permission than 'Everyone' in Settings -> General -> Pages access control, the url shown in the project Settings -> Pages redirect to an error page with 'The redirect URI included is not valid.' as description.
Steps to reproduce
- Install an omnibus gitlab server on a VPS.
- Set the wildcard DNS for the pages domain.
- Enable pages in gitlab.rb.
- Enable access control for pages in gitlab.rb.
- Build a pages with CI.
- Change access control of the page to anything different than 'everyone'.
- Access the url shown by the Pages tab in project settings.
What is the current bug behavior?
A page with an invalid redirect appear.
What is the expected correct behavior?
The page built in CI appear.
Relevant logs
Logs from /var/log/gitlab/gitlab-rails/production_json.log:
{"method":"GET","path":"/oauth/authorize","format":"html","controller":"Oauth::AuthorizationsController","action":"new","status":200,"duration":126.01,"view":114.03,"db":3.26,"time":"2019-02-08T08:06:54.990Z","params":[{"key":"client_id","value":"*****"},{"key":"redirect_uri","value":"http://projects.pages_domain.com/auth"},{"key":"response_type","value":"code"},{"key":"state","value":"*****"}],"remote_ip":null,"user_id":null,"username":null,"ua":null,"correlation_id":"*****"}
{"method":"GET","path":"/oauth/undefined","format":"html","controller":"ApplicationController","action":"route_not_found","status":404,"duration":57.67,"view":42.43,"db":2.03,"time":"2019-02-08T08:06:55.691Z","params":[{"key":"unmatched_route","value":"oauth/undefined"}],"remote_ip":"10.10.10.10","user_id":9,"username":"User","ua":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36","correlation_id":"*****"}
Details of package version
Gitlab version: 11.7.3-ee (d573592)
Environment details
Debian9 (Stretch)
Configuration details
## GitLab configuration settings
external_url 'https://gitlab.company.com'
## Container Registry settings
registry_external_url "https://registry.company.com"
gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_host'] = "registry.company.com"
## GitLab NGINX
nginx['redirect_http_to_https'] = true
nginx['redirect_http_to_https_port'] = 80
## GitLab Pages
pages_external_url "http://pages_domain.com/"
gitlab_pages['enable'] = true
gitlab_pages['access_control'] = true
gitlab_pages['redirect_http'] = false
## Let's Encrypt integration
letsencrypt['enable'] = true
letsencrypt['contact_emails'] = ['dev@company.com'] # This should be an array of email addresses to add as contacts
letsencrypt['auto_renew'] = true
letsencrypt['auto_renew_hour'] = 9
letsencrypt['auto_renew_minute'] = 30 # Should be a number or cron expression, if specified.
letsencrypt['auto_renew_day_of_month'] = "*/4"