Clone by http impossible with apache error 500 or 503

I have a common problem which is an error 500 or sometimes 503 when I try to clone a repository via http.

$ git clone
Clonage dans 'nbodypy'...
fatal: unable to access '': The requested URL returned error: 500

I’ve tried to follow some solutions found here for example: Error 500 when pull or clone but without success.

My config:

  • Apache gitlab.conf:
<VirtualHost *:80>
  ServerSignature Off
  RewriteEngine On
  RewriteCond %{HTTPS} off
  #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  RewriteRule .* unix:/var/opt/gitlab/gitlab-workhorse/socket|{REQUEST_URI} [P,QSA,NE] # i've tried both

  RewriteCond %{SERVER_NAME}
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

<VirtualHost *:443>   SSLEngine on
    #strong encryption ciphers only
    #see ciphers(1)
    SSLProtocol all -SSLv2
    SSLHonorCipherOrder on
    Header add Strict-Transport-Security: "max-age=15768000;includeSubdomains"
    SSLCompression Off
    SSLEngine On

    ServerSignature Off
    ProxyPreserveHost On
    # Ensure that encoded slashes are not decoded but left in their encoded state.
    AllowEncodedSlashes NoDecode
    <Location />
	# New authorization commands for apache 2.4 and up
	Require all granted
	#Allow forwarding to gitlab-workhorse
	ProxyPassReverse http://localhost:9191
    # Apache equivalent of nginx try files
    RewriteEngine on
    #Forward all requests to gitlab-workhorse except existing files like error documents
    RewriteCond %{REQUEST_URI} ^/uploads/.*
    RewriteRule .* http://localhost:9099%{REQUEST_URI} [P,QSA,NE]
    RequestHeader set X_FORWARDED_PROTO 'https'
    RequestHeader set X-Forwarded-Ssl on
    # needed for downloading attachments
    DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
    #Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
    ErrorDocument 404 /404.html
    ErrorDocument 422 /422.html
    ErrorDocument 500 /500.html
    ErrorDocument 502 /502.html
    ErrorDocument 503 /503.html
    # It is assumed that the log directory is in /var/log/httpd.
    # For Debian distributions you might want to change this to
    # /var/log/apache2.
    LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
    ErrorLog /var/log/apache2/gitlab_error.log
    CustomLog /var/log/apache2/gitlab_forwarded.log common_forwarded
    CustomLog /var/log/apache2/gitlab_access.log combined env=!dontlog
    CustomLog /var/log/apache2/gitlab.log combined
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/
    SSLCertificateKeyFile /etc/letsencrypt/live/
  • gitlab.rb
external_url ''
gitlab_workhorse['enable'] = true            
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_umask'] = 000    
gitlab_workhorse['listen_addr'] = "localhost:9191"    
gitlab_workhorse['dir'] = "/var/opt/gitlab/gitlab-workhorse"

user['username'] = "gitlab"
user['group'] = "gitlab"

unicorn['listen'] = 'localhost'
unicorn['port'] = 9099

web_server['external_users'] = ['www-data']#[]         
web_server['username'] = 'apache' #'gitlab-www'       
web_server['group'] = 'apache' #'gitlab-www' 

nginx['enable'] = false


  • I have a SSL certificate generated by letsencrypt.
  • I had a gitolite installation before. So I’ve changed the default user for GitLab to gitlab.
  • Each time Imodify the gitlab.rb, I run
$ gitlab-ctl reconfigure
$ gitlab-ctl restart
  • I’ve installed the omnibus distribution (gitlab-ee) on Ubuntu 17.10 with apache2 as the web server but I had to modify the source to Xenial
deb xenial main
deb-src xenial main
  • The clone using a ssh key works well.