You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Lars Nielsen <la...@mit-web.dk> on 2010/11/28 00:50:46 UTC
[users@httpd] ProxyPass and remote ip-addresses
Hi there,
I have a setup with 2 servers where the first one works as a proxy to
the second.
On my proxy server i have this in apache's config:
<VirtualHost *:80>
ServerName www.hjemmesideteknik.dk
ServerAlias hjemmesideteknik.dk
ProxyPreserveHost On
ProxyPass / http://192.168.1.106/
ProxyPassReverse / http://192.168.1.106/
</VirtualHost>
and the proxy works fine and I can see the site from the internet. My
problem is that in the access log file for the site it puts my proxy's
IP-address in as the remote ip in stead of the original users ip.
How can I solve this so the users ip is written in the logfile?
192.168.1.105 - - [28/Nov/2010:00:27:26 +0100] "GET /cron.php HTTP/1.1"
200 - "-" "Wget/1.11.4"
192.168.1.105 - - [28/Nov/2010:00:28:18 +0100]
"GET /content/brug-af-cookies-i-php HTTP/1.1" 200 5224
"http://www.hjemmesideteknik.dk/node/3" "Mozilla/5.0 (X11; U; Linux
i686; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44
Safari/534.7"
192.168.1.105 - - [28/Nov/2010:00:29:04 +0100] "GET /logout HTTP/1.1"
302 20 "http://www.hjemmesideteknik.dk/content/brug-af-cookies-i-php"
"Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.7 (KHTML, like
Gecko) Chrome/7.0.517.44 Safari/534.7"
regards
Lars Nielsen
www.lfweb.dk
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] ProxyPass and remote ip-addresses
Posted by Joost de Heer <jo...@sanguis.xs4all.nl>.
On 11/28/2010 12:50 AM, Lars Nielsen wrote:
> Hi there,
>
> I have a setup with 2 servers where the first one works as a proxy to
> the second.
> On my proxy server i have this in apache's config:
>
> <VirtualHost *:80>
> ServerName www.hjemmesideteknik.dk
> ServerAlias hjemmesideteknik.dk
> ProxyPreserveHost On
> ProxyPass / http://192.168.1.106/
> ProxyPassReverse / http://192.168.1.106/
> </VirtualHost>
>
> and the proxy works fine and I can see the site from the internet. My
> problem is that in the access log file for the site it puts my proxy's
> IP-address in as the remote ip in stead of the original users ip.
>
> How can I solve this so the users ip is written in the logfile?
This is normal behaviour: the backend server only sees a connection from the
reverse proxy, since the original connection is terminated at the reverse proxy.
To solve this, see
http://httpd.apache.org/docs/current/mod/mod_proxy.html#x-headers (the
X-forwarded-for header).
Joost
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] ProxyPass and remote ip-addresses
Posted by Jeroen Geilman <je...@adaptr.nl>.
On 11/28/2010 12:50 AM, Lars Nielsen wrote:
> Hi there,
>
> I have a setup with 2 servers where the first one works as a proxy to
> the second.
> On my proxy server i have this in apache's config:
>
> <VirtualHost *:80>
> ServerName www.hjemmesideteknik.dk
> ServerAlias hjemmesideteknik.dk
> ProxyPreserveHost On
> ProxyPass / http://192.168.1.106/
> ProxyPassReverse / http://192.168.1.106/
> </VirtualHost>
>
> and the proxy works fine and I can see the site from the internet. My
> problem is that in the access log file for the site it puts my proxy's
> IP-address in as the remote ip in stead of the original users ip.
>
> How can I solve this so the users ip is written in the logfile?
>
Read the documentation for LogFormat:
http://httpd.apache.org/docs/current/mod/mod_log_config.html#logformat
It shows you how to log any variable apache knows about.
--
J.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org