0

I'm trying to hide my Kallithea back-end server (which is useful to manage Git/Mercurial repositories) address by using an Apache rule. I have a URL redirect from https://sub.domain1.com/gitrepos to https://sub.domain2.com/.

Atm, when I try to access https://sub.domain1.com/gitrepos/path/to/repo, it redirects to https://sub.domain2.com/path/to/repo

I'm looking for a way to hide the second server address. I'd like to access to https://sub.domain1.com/gitrepos/path/to/repo without being explicitely redirected to https://sub.domain2.com/path/to/repo

I did some tries with Apache configuration but it is not working and I'm not sure if it is something that I can handle on the back-end server side or if this is something that can be handled on the server that actually redirects.

Here is my current configuration:

<VirtualHost *:80>
        ServerName git-domain2.com
        ServerAlias git-domain2
        Redirect permanent / https://git-domain2.com/
</VirtualHost>


<VirtualHost *:443>
        ServerName git-domain2.com
        ServerAlias git-domain2

        <Proxy *>
          Require all granted
        </Proxy>

        ProxyPreserveHost On

        ProxyPass /gitrepos http://domain2.com:5000/ connectiontimeout=20 timeout=300
        ProxyPassReverse /gitrepos http://domain2.com:5000/

        #kallithea instance
        ProxyPass / http://domain2.com:5000/ connectiontimeout=20 timeout=300
        ProxyPassReverse / http://domain2.com:5000/

        #to enable https use line below
        SetEnvIf X-Url-Scheme https HTTPS=1
        #LogLevel warn
        SSLEngine on
        SSLProtocol all -SSLv2
        SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
        SSLCertificateFile /etc/pki/tls/certs/domain2.com.crt
        SSLCertificateKeyFile /etc/pki/tls/private/domain2.com.key
</VirtualHost>

Thanks for any help.

Lazao
  • 225
  • 6
  • 16
  • 1
    try `/gitrepos/` instead of `/gitrepos`, and try without `ProxyPreserveHost On` – Dusan Bajic Nov 28 '16 at 09:32
  • that didn't help. – Lazao Nov 28 '16 at 10:13
  • the description and the config bits do not match and it is quite hard to guess where the problem may be, if missing proxypassreverse entry or else. Also kind of odd to see you have proxy * and proxypass / in the same context, as one is for forward proxyinga dn the other for reverse proxying. Note that proxying and redirecting are two different things, so please correct the description/config and expressions to make it clear what you want, what happens, etc. – Daniel Ferradal Nov 28 '16 at 20:07

0 Answers0