Apache 2.4 - Varnish - mod_rapf dont return real client IP

rnc

Verified User
Joined
Jun 8, 2013
Messages
72
hello
i set up a server with CB 2 , APACHE 2.4 MPM Worker , PHP 5.3 FCGI
and then i put Varnish in front of the apache as reverse proxy

my problem is 1 of my customers have a system that sensitive to visitor IP

i installed mod_rapf_2
i curently in httpd_conf i have this module loaded

Code:
include /etc/httpd/conf/mod_rpaf.conf

and in
/etc/httpd/conf/mod_rpaf.conf i have

GNU nano 2.0.9 File: /etc/httpd/conf/mod_rpaf.conf

LoadModule rpaf_module /usr/lib/apache/mod_rpaf-2.0.so
RPAFenable On
RPAFproxy_ips serverIP Value (98.x.x.x)
RPAFsethostname On
RPAFheader X-Forwarded-For


and in varnish VCL i have tested al of these 3 methods for apache get real IP


sub vcl_recv {

#if (req.restarts == 0) {
# if (req.http.X-Forwarded-For) {
# set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
# } else {
# set req.http.X-Forwarded-For = client.ip;
# }
#}

# Add a unique header containing the client address
# remove req.http.X-Forwarded-For;
# set req.http.X-Forwarded-For = client.ip;


#remove req.http.X-Forwarded-For;
#set req.http.X-Forwarded-For = req.http.rlnclientipaddr;

}


could any one help whay i still get server ip instead of Client Ip on PHP codes ?>


and one more question is what is the X-Real-IP in mod_rapf and what is different with X-Forwarded-For


thanks
 
what's you source to instal lvarnish fronted of apache on directadmin?
 
mod_rpaf is not needed at all. Just add the following to /etc/httpd/conf/extra/httpd-includes.conf:
Code:
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 127.0.0.1
RemoteIPInternalProxyList /usr/local/directadmin/data/admin/ip.list
 
mod_rpaf is not needed at all. Just add the following to /etc/httpd/conf/extra/httpd-includes.conf:
Code:
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 127.0.0.1
RemoteIPInternalProxyList /usr/local/directadmin/data/admin/ip.list


I found the solution, and I decide to post here, and I see you post!. ;)

here is my:

<IfModule mod_remoteip.c>
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 127.0.0.1
RemoteIPInternalProxyList xxx.xxx.xxx.xxx
LogFormat "%a %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combined
</IfModule>

and I found this, for log file, loging the client ip, but is work whitout this too:

LogFormat "%a %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combined

thanks!
 
Back
Top