I cannot fix the icons on Gitlab bring proxied by Apache 2.4. My failure may be because I am not using passenger (passenger provided its own set of problems that were much deeper), but I took all the steps in running it under a proxied /gitlab
. I also ran:
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production RAILS_RELATIVE_URL_ROOT=/gitlab
I restarted Apache as well. No improvement. The icons were still missing (or I should say the font woff
file returns status 200
to the browser but with a size of 0). This is Gitlab 6.5. In my Apache SSL sites-enabled
conf file, this is what provides an SSL route to the world to our Gitlab:
<Proxy *>
Require all granted
</Proxy>
<Location ~ /(gitlab|assets)>
RequestHeader set X_FORWARDED_PROTO 'https'
SetEnv RAILS_RELATIVE_URL_ROOT "/gitlab"
Require all granted
Options -Multiviews
# apache equivalent of nginx try files
# http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files
# https://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:8085/%{REQUEST_URI} [P,QSA]
# needed for downloading attachments but does not work under Location directive
#DocumentRoot /home/git/gitlab/public
</Location>
ProxyPass /gitlab/ http://127.0.0.1:8085/gitlab/
ProxyPassReverse /gitlab/ http://127.0.0.1:8085/gitlab/
ProxyPass /gitlab http://127.0.0.1:8085/gitlab
ProxyPassReverse /gitlab http://127.0.0.1:8085/gitlab
# SOme of the CSS assets were not being generated with "/gitlab", so I proxy those too.
ProxyPass /assets http://127.0.0.1:8085/gitlab/assets
ProxyPassReverse /assets http://127.0.0.1:8085/gitlab/assets
Again, most of it works fine. Only the font resources return with a 0 size to the browser. Should I update the Location directive to a Directory?
Note: gitlab - icons replaced by rectangles did not help. And yes, there are other sites at the 443 port on my server so I can't just take this Apache config on its own port/domain if I don't have to. I likely just need some help understanding Apache 2.4. Am I missing anything in my Apache config?
Resources made use of: https://github.com/gitlabhq/gitlab-recipes/commit/be95bd4f9bd3244641a4c7e55eb75fcc29129ffd , https://github.com/gitlabhq/gitlabhq/issues/2365 , https://github.com/gitlabhq/gitlab-recipes/commit/c6c22b4fb68bbb6efb547cce6605dea4344ba9fe
Also failed with replacing the Location directive: Tried this, but not as successful:
Alias ^/(gitlab|assets) /home/git/gitlab/public
<Directory /home/git/gitlab/public>`
RequestHeader set X_FORWARDED_PROTO 'https'
SetEnv RAILS_RELATIVE_URL_ROOT "/gitlab"
Require all granted
Options -Multiviews
# https://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:8085/%{REQUEST_URI} [P,QSA]
</Directory>
Since it is under a relative root, you still would need to run the following as noted above in order to verify the correct mapping of the assets (which includes icons and CSS URLs):
For you non-relative URL users, leave off the extra relative URL portion
You can also restart as noted by @LpLrich :
For some older Linux setups instead use:
Then refresh your browser.
Yet none of the above steps worked on my system because, as best as I can say, imperfect Apache setup which I fixed below--including it in case you are finding the same issue of fixing Gitlab correctly but finding the end result failing in the browser. I did change to not using the relative URL root anymore but that doesn't matter so much. This should help Apache fix the issue above as well once the gitlab steps are completed. Sorry, the ProxyPassReverse is the main change you need to notice from the question's Apache setup:
(from https://github.com/gitlabhq/gitlab-recipes/blob/master/web-server/apache/gitlab-ssl-apache2.4.conf)
This might help you,
https://github.com/gitlabhq/gitlabhq/issues/3306#issuecomment-15971720
Basically it's saying to run a
rake assets:clean
and then aassets:precompile
and then aservice gitlab restart
I had precompiled my assets, checked the public/assets folder and could see they existed but some icons were not showing so I cleaned them out, precompiled again and restarted it then they started showing up.
Run
sudo -u git -H bundle exec rake assets:clean RAILS_ENV=production
Then
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production RAILS_RELATIVE_URL_ROOT=/gitlab
And refresh the page, if it's not working try
sudo service gitlab restart
But I looked in my history there now and I couldn't see myself restarting it so I am assuming that when this happened to me I simply cleaned them out and precompiled them again and I didn't have to restart.