I am migrating some sites from one server to another. To avoid any downtime, I am proxying moved sites through the old server while the DNS updates.
On the original (proxy) server, I have the following:
<VirtualHost *:80>
Servername www.mydomain.com
DocumentRoot /var/www/mydomain.com
ProxyPass / http://my-new-server-ip-address/
ProxyPassReverse / http://my-new-server-ip-address/
ProxyPreserveHost On
</VirtualHost>
On the new server I am using mod_remoteip (Apache version 2.4.7) and have the following:
<VirtualHost *:80>
Servername www.mydomain.com
DocumentRoot /var/www/mydomain.com
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy my-old-server-ip-address
LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" (proxy)" proxy
SetEnvIf X-Forwarded-For "/.*/" forwarded
# just testing for anything here!!
CustomLog /var/log/mydomain.com/access.log combined env=!forwarded
CustomLog /var/log/mydomain.com/access.log proxy env=forwarded
</VirtualHost>
What I am trying to achieve is that a different log is used when the request has been proxied as opposed to a direct request from the new server. The "proxy" log never gets executed which makes me think that the "X-Forwarded-For" header is not sent by the original server. The apache docs here state that "X-Forwarded-For" is one of the headers set along.
I know I am missing something obvious but any help would be appreciated!