Apache Reverse Proxy / http>https Redirect with multiple IP addresses

Yesterday I had the issue, that I configured 3 NIC´s for an Apache Reverse Proxy, but only for one IP the redirect for http >> https worked.

I did some investigation and found out, that the entry “HWADDR” with the corresponding MAC address was missing in the additional NIC configuration for “eth1”, “eth2” and “eth3”. So I added the information in the ifcfg-eth1, … file and restarted the network services and also the httpd service.

But >> did not work at all… 😦

Today I did some further investigation and figured out the problem: checking, which IP is listening on port 80 I received the following information:

[root@ibmpxy.company.com sites-available]# netstat -an | grep “:80”
tcp 0 0 172.18.0.15:80 0.0.0.0:* LISTEN

This was the IP address of eth0… But why did the Apache server not listen on port 80 for the additional IP addresses bound to the other NIC´s ??

The problem was located in the httpd.conf:

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
Listen 172.18.0.15:80

Only eth0 was listed in here !! After adding the additional IP addresses

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
Listen 172.18.0.9:80
Listen 172.18.0.10:80
Listen 172.18.0.15:80

and restarting the httpd service, it looked much better:

[root@ibmpxy.company.com conf]# netstat -an | grep “:80”
tcp 0 0 172.18.0.15:80 0.0.0.0:* LISTEN
tcp 0 0 172.18.0.10:80 0.0.0.0:* LISTEN
tcp 0 0 172.18.0.9:80 0.0.0.0:* LISTEN

And now the redirection of http >> https also is working for the other connect requests with a simple configuration:

<VirtualHost 172.18.0.10:80>
ServerName connect.company.com

ErrorLog /var/www/virtual/logs/connect.company.com_error.log
CustomLog /var/www/virtual/logs/connect.company.com_access.log common

# Redirect all requests to SSL
Redirect permanent / https://connect.company.com/

</VirtualHost>

Advertisements