Author Topic: IP addresses of all visitors ???  (Read 12979 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
IP addresses of all visitors ???
« on: January 24, 2016, 07:26:12 PM »
ex. Server ip adress : 123.123.123.123

Any visitors IP address: 123.123.123.123

the same IP address of all visitors why?

please help :( :(

Offline
*
Re: IP addresses of all visitors ???
« Reply #1 on: January 24, 2016, 07:59:44 PM »
Are you running varnish? It does that out of the box, you need to configure it to pass the IP back in a custom header then tell apache to log that header instead of the IP. There's a discussion of how to do that here:
http://forum.centos-webpanel.com/apache/website-server-logs-wordpress-etc/

Offline
*
Re: IP addresses of all visitors ???
« Reply #2 on: January 24, 2016, 08:47:31 PM »
Yes running varnish ?

Offline
*
Re: IP addresses of all visitors ???
« Reply #3 on: January 25, 2016, 02:48:31 AM »
The client makes an http request to your domain and gets directed to the varnish server, which is mostly transparent to the end user. The varnish server checks its cache and if it has the file it serves it. If not it asks the apache server for the file. The apache server knows nothing about the end user unless you tell varnish to tell apache about it. You can't pass the client's ip straight through because apache can't reply directly back to the client, the client will drop the packets, so you set up a custom field that has the client's ip in it. Now all you have to do is tell Apache to log that field instead of the IP and you're in business.

The link I mentioned above explains how to do this, but unless you're will to spend some time learning how to configure varnish there's not much point to running it.

Offline
*
Re: IP addresses of all visitors ???
« Reply #4 on: January 25, 2016, 10:32:41 AM »
Thanks for the reply.
However, some modes can handle it. I think.


This code does not solve the problem


Code: [Select]
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;
  }
}


However, I think I need php module?


This does not solve the problem? How did you solve first?

regards

Offline
*
Re: IP addresses of all visitors ???
« Reply #5 on: January 25, 2016, 04:45:48 PM »
I use:

Code: [Select]
sub vcl_recv { include "/etc/varnish/sites.vcl";
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
[insert the rest of your vcl_recv]
}

This alone won't work because all you're doing is passing the info to apache, you also have to tell apache to log it:
In /usr/local/conf/httpd.conf
change your logging format to:
LogFormat "%{X-Forwarded-For}i %l %u %t %v \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
and make sure it says "combined" after your logging path:
CustomLog "/usr/local/apache/logs/access_log" combined
restart apache (service httpd restart)

Offline
*
Re: IP addresses of all visitors ???
« Reply #6 on: February 06, 2016, 06:45:40 PM »
I use:

Code: [Select]
sub vcl_recv { include "/etc/varnish/sites.vcl";
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
[insert the rest of your vcl_recv]
}

This alone won't work because all you're doing is passing the info to apache, you also have to tell apache to log it:
In /usr/local/conf/httpd.conf
change your logging format to:
LogFormat "%{X-Forwarded-For}i %l %u %t %v \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
and make sure it says "combined" after your logging path:
CustomLog "/usr/local/apache/logs/access_log" combined
restart apache (service httpd restart)

I made the corrections as you said.

however, the situation looks the same server as the IP address of the user. :( :( :( :(

Offline
*****
Re: IP addresses of all visitors ???
« Reply #7 on: February 14, 2016, 06:36:12 AM »
Hello.

That is Varnish trouble... You can see real IP in an access log files.
You can ask me to solve any problem with your server for some money in pm  ;)
Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor
Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp

Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services