Gitlab with apache proxy

apache-2.2gitlabPROXY

I have an apache2 server running on a Mac OS X machine with the same machine running Gitlab virtually in Ubuntu.

Mac IP: 192.168.0.7

Ubuntu (virtual) IP: 192.168.0.12

I would like apache to make gitlab.mydomain.com to go to the Ubuntu virtual machine while anythingelse.mydomain.com go to the Mac.

I added a file (gitlab.mydomain.conf) to /private/etc/apache2/other/ (on the Mac) with the following contents

<VirtualHost *:80>
  ServerName gitlab.mydomain.com
  ProxyPass / http://192.168.0.12
  ProxyPassReverse / http://192.168.0.12
  ProxyPreserveHost On

</VirtualHost>

The gitlab.yml on the Ubuntu virtual machine file contains

##Gitlab settings
gitlab:
  ## Web server settings
  host: gitlab.mydomain.com
  port: 80
  https: false

When I go to gitlab.mydomain.com I get the following error:

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /users/sign_in.

Reason: DNS lookup failure for: 192.168.0.12users

But if I go to 192.168.0.12 I get the Gitlab sign in page.

Any ideas on what is wrong?

Best Answer

try

<VirtualHost *:80>
  ServerName gitlab.mydomain.com
  ProxyPass / http://192.168.0.12/
  ProxyPassReverse / http://192.168.0.12/
  ProxyPreserveHost On
</VirtualHost>

From mod_proxy ProxyPass docs

If the first argument ends with a trailing /, the second argument
should also end with a trailing / and vice versa. Otherwise the
resulting requests to the backend may miss some needed slashes and
do not deliver the expected results.
Related Topic