Setting Up IP Address Logging in Linux OS

IP address logging settings for the workstation, which allows access to object, in access protocol depend on whether there is a balancer between web servers cluster and web application.

The configuration with balancer located between web servers cluster and web application:

Determine settings:

  1. Comment the strings in the balancer in the location directive:

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Replace them with the string:

proxy_set_header userhostaddress $proxy_add_x_forwarded_for;

  1. On web servers in the configuration file:

Comment the strings:

SetEnvIf REMOTE_ADDR "^(.+)$" USER_CLIENT_ADDR=$1

RequestHeader merge userhostaddress "%{USER_CLIENT_ADDR}e"

The configuration without balancer located between web servers cluster and web application:

On web servers in the configuration file:

Check if the following strings are present:

SetEnvIf REMOTE_ADDR "^(.+)$" USER_CLIENT_ADDR=$1

RequestHeader merge userhostaddress "%{USER_CLIENT_ADDR}e"

See also:

Questions and Answers | Creating BI Servers Cluster