Hide back-end server address using Apache configuration

357 Views Asked by At

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.

0

There are 0 best solutions below