Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

show https url in gitlab behind load balancer

Tags:

git

gitlab

I am running gitlab behind a load balancer which is handle my SSL. I have gitlab running as non SSL and the load balancer handlles the https connections. my question is how can I get the path to the repository in the "Activity" section to show https instead of http? The users may be confused when it is showing http but the correct url is https.

like image 966
arrowill12 Avatar asked Dec 07 '25 21:12

arrowill12


1 Answers

I could not find a "perfect" solution, but what I did is, I set the external_url in the gitlab.rb config file to HTTPS and added the following lines to the nginx configuration (/var/opt/gitlab/nginx/conf) manually:

location / {
  ...

  proxy_set_header    Host                $http_host;
  proxy_set_header    X-Real-IP           $remote_addr;
  proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
  proxy_set_header    X-Forwarded-Proto   https;
  proxy_set_header    X-Forwarded-Ssl     on;
  proxy_set_header    X-Url-Scheme        https;

  ...
}

After restarting Gitlab with gitlab-ctl restart everything worked for me. Be aware that with the next gitlab-ctl reconfigure these changes will be lost.

Currently I don't know how to add the required nginx configuration directly to the gitlab.rb configuration.

like image 117
Michael Lihs Avatar answered Dec 10 '25 11:12

Michael Lihs