Recently, I have moved my personal source code to GitLab. It rendered self-hosted git repository at repository.sleeplessbeastie.eu obsolete, so I have created simple redirection on HAProxy load balanced to cover this specific case.

Permanently redirect every request to repository.sleeplessbeastie.eu domain to <a href="https://gitlab.com/milosz.galazka" rel="nofollow">https://gitlab.com/milosz.galazka</a> location.

acl is-repository hdr_dom(host) -i repository.sleeplessbeastie.eu
http-request redirect location https://gitlab.com/milosz.galazka code 301 if is-repository

Verify that it works as expected.

$ curl --verbose --silent --location --output /dev/null https://repository.sleeplessbeastie.eu
* Rebuilt URL to: https://repository.sleeplessbeastie.eu/
*   Trying 84.16.240.28...
* TCP_NODELAY set
* Connected to repository.sleeplessbeastie.eu (84.16.240.28) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: repository.sleeplessbeastie.eu
* Server certificate: Let's Encrypt Authority X3
* Server certificate: DST Root CA X3
> GET / HTTP/1.1
> Host: repository.sleeplessbeastie.eu
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Content-length: 0
< Location: https://gitlab.com/milosz.galazka
<
* Connection #0 to host repository.sleeplessbeastie.eu left intact
* Issue another request to this URL: 'https://gitlab.com/milosz.galazka'
*   Trying 52.167.219.168...
* TCP_NODELAY set
* Connected to gitlab.com (52.167.219.168) port 443 (#1)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: gitlab.com
* Server certificate: COMODO RSA Domain Validation Secure Server CA
* Server certificate: COMODO RSA Certification Authority
> GET /milosz.galazka HTTP/1.1
> Host: gitlab.com
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Wed, 24 Jan 2018 01:55:45 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Cache-Control: max-age=0, private, must-revalidate
< Etag: W/"dd7648465b5764790dc2a7f0f11be658"
< Set-Cookie: _gitlab_session=341990252dd0180f509f0ff3bf2d485c; path=/; secure; HttpOnly
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< X-Request-Id: e14e3c77-1c94-49a4-8e60-b564f0fab5fd
< X-Runtime: 0.072131
< X-Ua-Compatible: IE=edge
< X-Xss-Protection: 1; mode=block
< Strict-Transport-Security: max-age=31536000
< Content-Security-Policy: object-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://assets.gitlab-static.net https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/; style-src 'self' 'unsafe-inline' https://assets.gitlab-static.net; img-src * data: blob:; frame-src 'self' https://www.google.com/recaptcha/; frame-ancestors 'self'; connect-src 'self' https://assets.gitlab-static.net wss://gitlab.com https://sentry.gitlap.com https://customers.gitlab.com; report-uri https://sentry-infra.gitlap.com/api/3/csp-report/?sentry_key=a664fdde83424b43a991f25fa7c78987
<
{ [14792 bytes data]
* Connection #1 to host gitlab.com left intact