4

I have to configure a reverse proxy to redirect the HTTPs Request to another host which is also running HTTPs,,,But I get stuck

Here is the virtualhost configuration on my Apache as the reverse Proxy

<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName mail.mydomain.com

RewriteEngine   on
RewriteCond     %{SERVER_PORT} ^80$
RewriteRule     ^(.*)$ https://%{SERVER_NAME}$1 [L,R]

SSLProxyEngine on

<Proxy "*">
        Order allow,deny
        Allow from all
</Proxy>

   ProxyPass / https://192.168.1.6/webmail/
   ProxyPassReverse / https://192.168.1.6/webmail/

    ErrorLog /var/log/apache2/webmail_log
    CustomLog /var/log/apache2/webmail-access_log combined
</VirtualHost>

On my browser I use this address http://mail.mydomain.com

But it only redirect the request to the HTTPs at the reverse proxy server not the HTTPs at the mail host.

Thanks folks

1 Answer 1

5

I haven't set up a https reverse proxy yet but I'm about to do it right now

as far as I can tell your proxy definition is in the wrong place.

Your RewriteRule redirects you away from your http virtual host to your https virtual host, so there's the place where the proxy config has to go.

EDIT: basically I meant this:

remove the proxy from the vhost on port 80

<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName mail.mydomain.com

        RewriteEngine   on
        RewriteCond     %{SERVER_PORT} ^80$
        RewriteRule     ^(.*)$ https://%{SERVER_NAME}$1 [L,R]



        ErrorLog /var/log/apache2/webmail_log
        CustomLog /var/log/apache2/webmail-access_log combined
</VirtualHost>

and add it to the vhost listening on port 443 (https)

<VirtualHost *:443>

... other vhost config ....

        SSLProxyEngine on

        <Proxy "*">
                Order allow,deny
                Allow from all
        </Proxy>

        ProxyPass / https://192.168.1.6/webmail/
        ProxyPassReverse / https://192.168.1.6/webmail/
</VirtualHost>

I haven't tested this exact setup but I think it should work like this...

1
  • Marcel! did you get it to work? Can you explain the note above, and perhaps give the config?
    – user62085
    Nov 30, 2010 at 22:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .