GitLab Pages broken with infinite redirect loop
Currently, GitLab pages is broken and not accessible. There is an infinite redirect loop as shown with below curl
command:
$ curl -I https://hifis.pages.hzdr.de/hifis.net
HTTP/2 301
date: Wed, 06 Jan 2021 06:16:46 GMT
server: Apache
strict-transport-security: max-age=63072000
content-type: text/html; charset=utf-8
location: https://hifis.pages.hzdr.de/hifis.net
Workaround
@hueser93 discovered, that disabling Force HTTPS in the pages project settings resolves the issue.
Possible reason
- The GitLab pages daemon serves request sitting behind an Apache webserver
- Possibly, the GitLab pages daemon thinks, that the page should be served via http
- We might be able to find a solution by adapting the Apache configuration.
Solution
Correctly configure the X-Forwarded-Proto
and X-Forwarded-Ssl
headers in the Apache configuration. This is done by adding these two lines into the Apache configuration.
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Ssl on
See also https://gitlab.hzdr.de/fwcc/HZDR-GitLab/-/issues/107#note_585892