Preserve original host IP via Apache reverse proxy using mod_extract_forwarded in CentOS

Using Apache as a reverse proxy can cause difficulty when reviewing backend web server logs. The default Apache server configuration will incorrectly log the reverse proxy host as being the origin IP address, instead of the actual IP that sent the request. Luckily there is a pretty simple fix to this using the Apache module mod_extract_forwarded. Using this module is much simpler and easier to install than using the alternative method using the mod_rpaf module.

This guide focuses on Apache installations running on CentOS, however the configuration will be applicable to other Redhat distros too.

First ensure that you have the EPEL repository installed and configured. See here

Install the mod_extract_forwarded Apache module

sudo yum install mod_extract_forwarded

Edit the mod_extract_forwarded.conf, uncomment the MEFaccept line and replace the sample IP addresses with your own reverse proxy IP.

sudo vi /etc/httpd/conf.d/mod_extract_forwarded.conf

Restart Apache to take effect and verify the module is loaded.

sudo service httpd restart
yum list installed | grep forward 

Install EPEL repository on CentOS 5.x or 6.x

In order to install extra packages like PHP, MySQL and other cool stuff in RHEL based distros like CentOS, it’s usually a pretty good idea to configure Yum to make use of the EPEL repository. EPEL stands for Extra Packages for Enterprise Linux.

CentOS 5.x

wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
sudo rpm -Uvh epel-release-5*.rpm
rm epel-release-5*

CentOS 6.x

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm
rm epel-release-6*

The rm command at the end is optional, it just removes the downloaded .rpm file as it’s no longer needed.

Output from running the command below will verify a successful installation.

ls -1 /etc/yum.repos.d/epel*

As so..

/etc/yum.repos.d/epel.repo
/etc/yum.repos.d/epel-testing.repo

Actuator Agony

On the way back home from showing the car to Dale over at Bailey Performance Ltd, the Mk1 suddenly stopped producing boost and lost majority of its power. It was still driving smoothly and sounded okay however I could hear the turbo wasn’t spooling up. Only being a short distance from home I trundled on at a slow speed and avoided putting the engine under any great load.

After a quick inspection as to what was wrong with the engine I removed this from the turbo.

Broken Actuator
Snapped actuator connecting rod

The connecting rod on the waste-gate actuator had snapped, meaning that the waste-gate was uncontrollable and was permanently open. For those who are unfamiliar with how turbo setups work, the waste-gate prevents the turbo from spinning too fast and causing engine damage by diverting exhaust gases away when a predetermined level of pressure is attained. Without sufficient gas flow the turbo is unable to spool up. The waste-gate is only meant to momentarily open to reduce turbo spin, however in my situation today the permanently open waste-gate resulted in no boost being produced at all.

Broken Actuator
The weld on the rod has snapped, a careful re-weld is required

Broken Actuator
How the actuator should look, minus the break in weld.

Next on the to-do list.. reattach and re-weld the connecting rod to the actuator.