I have recently deployed GitLab with GitLab Pages on our local environment. Its a linux hosted instance of GitLab 17.3.1 and is deployed behind a Traefik reverse proxy. I also deployed a runner on a separate container to build the Docker files.
I am trying to deploy the HTML Pages template, but I cannot seem to get it working. The build and deploy process is successful according to the job report, however, I cannot access the deployed page or even the artifact. Both give an error 502. I have tried every setting I could find, even just the plain wildercard domain directly to GitLab (without going through Traefik) and I always get the same error 502.
I need help please.
a.b.c.d = replace the IP address
x.y.z = replaced our domain
Below is an extract of the gitlab.rb file:
nginx['listen_https'] = false
nginx['proxy_set_headers'] = {"X-Forwarded-Proto" => "https","X-Forwarded-Ssl" => "on"}
nginx['listen_addresses'] = ['a.b.c.d']
nginx['listen_port'] = 80
letsencrypt['enable'] = false
external_url 'https://gitlab.x.y.z'
pages_external_url 'https://docs.x.y.z'
gitlab_pages['enable'] = true
pages_nginx['listen_https'] = false
pages_nginx['listen_port'] = 15002
pages_nginx['proxy_set_headers'] = {"X-Forwarded-Proto" => "https","X-Forwarded-Ssl" => "on"}
Here is the .gitlab-ci.yml file:
# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/pages/plain-html
image: busybox
pages:
stage: deploy
script:
- echo "The site will be deployed to $CI_PAGES_URL"
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Running with gitlab-runner 17.3.1 (66269445)
[2] on Gitlab-runner1 qsyc9Vnh9, system ID: s_9b6fc9f7e1e2
[3]Preparing the "docker" executor00:02
[4]Using Docker executor with image busybox ...
[5]Pulling docker image busybox ...
[6]Using docker image sha256:87ff76f62d367950186bde563642e39208c0e2b4afc833b4b3b01b8fef60ae9e for busybox with digest busybox@sha256:34b191d63fbc93e25e275bfccf1b5365664e5ac28f06d974e8d50090fbb49f41 ...
[7]Preparing environment00:00
[8]Running on runner-qsyc9vnh9-project-13-concurrent-0 via Gitlab-runner...
[9]Getting source from Git repository00:02
[10]Fetching changes with git depth set to 20...
[11]Reinitialized existing Git repository in /builds/cyberrange/doctest/.git/
[12]Checking out 183e947b as detached HEAD (ref is master)...
[13]Skipping Git submodules setup
[14]Executing "step_script" stage of the job script00:00
[15]Using docker image sha256:87ff76f62d367950186bde563642e39208c0e2b4afc833b4b3b01b8fef60ae9e for busybox with digest busybox@sha256:34b191d63fbc93e25e275bfccf1b5365664e5ac28f06d974e8d50090fbb49f41 ...
[16]$ echo "The site will be deployed to $CI_PAGES_URL"
[17]The site will be deployed to https://cyberrange.docs.x.y.z/doctest
[18]Uploading artifacts for successful job00:01
[19]Uploading artifacts...
[20]public: found 3 matching artifact files and directories
[21]Uploading artifacts as "archive" to coordinator... 201 Created id=79 responseStatus=201 Created token=glcbt-64
[22]Job succeeded
GitLab Pages Error log:
{"correlation_id":"01J710DHMD461Y5FWBWA06SH4Q","error":"invalid character '\u003c' looking for beginning of value","host":"cyberrange.docs.x.y.z","level":"error","msg":"could not fetch domain information from a source","path":"/doctest","time":"2024-09-05T13:51:49+02:00"}
{"content_type":"text/html; charset=utf-8","correlation_id":"01J710DHMD461Y5FWBWA06SH4Q","duration_ms":0,"host":"cyberrange.docs.x.y.z","level":"info","method":"GET","msg":"access","pages_https":true,"proto":"HTTP/1.1","referrer":"","remote_addr":"10.1.1.15","remote_ip":"10.1.1.15","status":502,"system":"http","time":"2024-09-05T13:51:49+02:00","ttfb_ms":0,"uri":"/doctest","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36","written_bytes":2905}
{"correlation_id":"01J710DHMV4Y4VE71NSBN5KXCB","error":"invalid character '\u003c' looking for beginning of value","host":"cyberrange.docs.x.y.z","level":"error","msg":"could not fetch domain information from a source","path":"/favicon.ico","time":"2024-09-05T13:51:49+02:00"}
{"content_type":"text/html; charset=utf-8","correlation_id":"01J710DHMV4Y4VE71NSBN5KXCB","duration_ms":0,"host":"cyberrange.docs.x.y.z","level":"info","method":"GET","msg":"access","pages_https":true,"proto":"HTTP/1.1","referrer":"https://cyberrange.docs.x.y.z/doctest","remote_addr":"10.1.1.15","remote_ip":"10.1.1.15","status":502,"system":"http","time":"2024-09-05T13:51:49+02:00","ttfb_ms":0,"uri":"/favicon.ico","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36","written_bytes":2905}