HAProxy is included in the package management systems of most Linux distributions. Use the below command to install haproxy in RHEL 9.2.
Below is the HAproxy config file (
/etc/haproxy/haproxy.cfg)which we used in this setup:
The above configuration is tweaked for use with SSL installed.
Import the SSL certificate to a pem file, and specify the path as in the sample haproxy.cfg above
Configuring webserver to log public IP addresses behind a load balancer
The mod_remoteip is already enabled by default in RHEL.
Edit the Apache configuration located at /etc/httpd/conf/httpd.conf for RHEL as follows:
Add this line to the configuration file.
Find the matching section that begins with LogFormat. Change this line:
to this: (Replace %h with %a in the configuration file)
To apply the changes, save the configuration file, and then restart Apache on your RHEL instance.
Verify that the client IP is getting logged using this command on your RHEL instance and make a request from another instance.