I have two servers behind my router, both are web servers with opensuse on it. Router redirects traffic on 80 to first server.
But because first one is not so powerful I moved one of the web sites to the second one. I used mod_proxy to redirect domain to second server. I also added DNS record that resolve that domain to second server.
Now, everything is working… except I can’t see client source IP’s in log file of second server instead of that is see IP of my proxy server
What can I do to resolve this problem?
Thanks for your help.
Here is my vhost config for the domain
<VirtualHost 192.168.0.4>
ServerName www.domain.com
ServerAlias www.domain.com
ProxyRequests Off
CustomLog /var/log/apache2/domain.com-access.log combined
ErrorLog /var/log/apache2/domain.com-error.log
LogLevel warn
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off
# configures the footer on server-generated documents
ServerSignature On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://www.domain.com/
ProxyPassReverse / http://www.domain.com/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
<VirtualHost 192.168.0.5>
DocumentRoot /srv/www/htdocs/www.domain.com
ServerName www.domain.com
ServerAlias www.domain.com
CustomLog /var/log/apache2/domain.com-access.log combined
ErrorLog /var/log/apache2/domain.com-error.log
LogLevel warn
<Directory "/srv/www/htdocs/www.domain.com">
allow from all
Options -Indexes
AllowOverride All
</Directory>
</VirtualHost>
Server1: With preserve host directive.
<VirtualHost 192.168.0.4>
ServerName www.domain.com
ServerAlias www.domain.com
ProxyRequests Off
CustomLog /var/log/apache2/domain.com-access.log combined
ErrorLog /var/log/apache2/domain.com-error.log
LogLevel warn
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off
# configures the footer on server-generated documents
ServerSignature On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyPass / http://www.domain.com/
ProxyPassReverse / http://www.domain.com/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>