Skip to content

Commit e5dc2dd

Browse files
Gaibhnekkimurak
authored andcommitted
healthcheck: Use IPv4 loopback address instead of localhost
Access to health check resources such as /-/liveness is restricted to IPs specified in gitlab.monitoring.ip_whitelist (`GITLAB_MONITORING_IP_WHITELIST`). The name `localhost` is solved to IPv6 loopback address (::1) that is not listed in the whitelist by default. Possible alternate designs: - Add IPv6 loopback to whitelist - Disable IPv6 for gitlab container by specifying `net.ipv6.conf.all.disable_ipv6=1` in docker-compose.yml for example See #2766 (comment)
1 parent ba429ab commit e5dc2dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

assets/runtime/functions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,7 @@ generate_healthcheck_script() {
18641864
fi
18651865
cat > /usr/local/sbin/healthcheck <<EOF
18661866
#!/bin/bash
1867-
url=${HEALTHCHECK_PROTOCOL}://localhost${GITLAB_RELATIVE_URL_ROOT}/-/liveness
1867+
url=${HEALTHCHECK_PROTOCOL}://127.0.0.1${GITLAB_RELATIVE_URL_ROOT}/-/liveness
18681868
options=( '--insecure' '--silent' )
18691869
curl "\${options[@]}" \$url
18701870
[[ "\$(curl \${options[@]} -o /dev/null -I -w '%{http_code}' \$url)" == "200" ]]

0 commit comments

Comments
 (0)