I have been checking this previous question Apache Virtual Host SSL Behind Reverse Proxy that seems to be similar to what I am looking for.
The main differences are two:
- I am not using SSL (for now)
- DataPower is the reverse proxy before the Apache HTTP Server.
I have the following config on Apache:
<VirtualHost *:7777>
ServerName testsite.example.com
Port 80
ServerAdmin you@your.address
RewriteEngine On
RewriteOptions inherit
</VirtualHost>
<VirtualHost *:7777>
ServerName testserver-01.example.com
Port 7777
ServerAdmin you@your.address
RewriteEngine On
RewriteOptions inherit
</VirtualHost>
<VirtualHost *:7777>
ServerName testsite.example.com
Port 7777
ServerAdmin you@your.address
RewriteEngine On
RewriteOptions inherit
</VirtualHost>
<VirtualHost *:7777>
ServerName testserver-02.example.com
Port 7777
ServerAdmin you@your.address
RewriteEngine On
RewriteOptions inherit
</VirtualHost>
DataPower is load balancing testserver-01 and testserver-02 and also proxies them publishing the testsite.example.org hostname in port 80.
Since the web application uses HTML Login Forms, DataPower does not follow redirects, to avoid the request for /j_security_check getting rejected.
But, although the option "Rewrite URL" is set as On, every time we get into the web application we end up at the testserver-01 IP address, jumping DataPower in the request.
I need to get that fixed, so DataPower ALWAYS takes part in the request flow, through testsite.example.com
Is there maybe something wrong with the Apache httpd.conf
?