2

I know the topic get endless threads on the web, but I didn't find neither the problem I have nor any close solution.

I installed Gitlab 7.5.3 with omnibus package. As I got apache already setted up, I used it to serve GitLab as well. Everything is working but the attachments on front-end... Wether all gitlab resources are set on relative path, (such as /assets/favicon-baaa14bade1248aa6165e9d34e7d83c0.ico), my uploaded attachments, such as avatar images, got the hostname prefixed before the path (http://vpxXXX.ovh.net/uploads/path/to/attachment).

If I remove the hostname in elements inspector, the attachment show up.

What is wrong in my conf? Why is this impacting only uploads?

2 things

  • Attachments are correctly uploaded. I can see them in my filesystem (as I can serve them removing the hostname, said above).

  • hostname is different from domainname : last one is the "real" domain name I want to acess the server with. Hostname is set by my hosting company (OVH, so its vpsXXXX.ovh.net)

    before code :

/etc/gitlab/config.rb :

# Check and change the external_url to the address your users will type in their browser
external_url = 'http://domainname.com:8080'
nginx['enable'] = false

Apache vhost :

<VirtualHost *:80>
    ServerName git.domainame.com
    ServerSignature Off

    ProxyPreserveHost On

    <Location />
       Order deny,allow
       Allow from all

       ProxyPassReverse http://127.0.0.1:8080
       ProxyPassReverse http://git.domainame.com

   </Location>

   RewriteEngine on
   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
   RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]

   # needed for downloading attachments
   DocumentRoot /var/opt/gitlab/gitlab-rails/uploads

   ErrorDocument 404 /404.html
   ErrorDocument 422 /422.html
   ErrorDocument 500 /500.html
   ErrorDocument 503 /deploy.html

   LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
   ErrorLog  /${APACHE_LOG_DIR}/gitlab.error.log
   CustomLog /${APACHE_LOG_DIR}/gitlab.forwarded.log common_forwarded
   CustomLog /${APACHE_LOG_DIR}/gitlab.access.log combined env=!dontlog
   CustomLog /${APACHE_LOG_DIR}/gitlab.log combined
</VirtualHost>
Community
  • 1
  • 1
nbonniot
  • 1,034
  • 16
  • 33

1 Answers1

1

The solution was in a mismatch between my FQDN and the hostname... As soon I set them identical, it worked.

Still using fqdn:8080 instead git.domainname.com though. using Apache reverse proxy is incredibly slow with my configuration, and most of the times got 502 errors.

I found numerous posts on this problems between gitlab, bundle nginx on some port, and apache with mod_proxy on 80 : but so far no real solution fully acceptable and scalable.

If any clue, feel free to let me know !

Nicolas

nbonniot
  • 1,034
  • 16
  • 33