Gitlab relative URL under apache proxy pass

1.7k views Asked by At

I am running gitlab inside a docker which is mapped to port 8880 on my localhost. So I can access it using the URL
http://localhost:8880

But I have used apache proxy pass to create following mapping
localhost:8880 ------> localhost/gitlab

So that my users can access gitlab through localhost/gitlab. Everything seems to be working fine but the problem arises when the page is rendered. All the link in the page generated by Gitlab uses relative url like

  • /assets/favicon-baaa14bade1248aa6165e9d34e7d83c0.ico
  • /assets/application-296ff8a0c87574e522a2911224b5350b.css
  • /assets/print-1df3ea9b8ff148a6745321899e0cb213.css
  • This causes apache to redirect them to localhost/assets/... when clicked. Which results in 404 Error which is obvious as the resource path is incorrect. The link should have been generated as localhost/gitlab/assets/.... so that apache can map them correctly to localhost/gitlab/assets/...

    I have tried using the Apache rewrite module, Nginx rewrite module but none of them worked. Is there anyway I can change the relative URL generated by gitlab?

    1

    There are 1 answers

    2
    Justice O. On

    Sorry this feature is not currently supported in gitlab. If you must use a relative url, consider using omnibus gitlab as it has support for relative urls.

    When you send a request to localhost/gitlab, the apache server faithful forwards it to localhost:8880. But neither gitlab nor nginx know it is coming from a relative url, only apache does. This becomes a problem since the resource paths in gitlab are constructed with the fqdn - localhost:8880. And apache only modifies the header of the request to localhost/gitlab not the links and resources embedded in the request.