1and1 Help Centre Categories

print article

Determine a Client's IP when Using a Load Balancer (IIS)

1&1 Cloud Server running Windows Server operating systems

If your server is utilizing a load balancer, then the load balancer acts as a middle-man which pulls content from your server and serves it to your site visitors. If you check the access logs for the web server, you will find that it contains only the IP address of the load balancer. To determine a user's actual IP address that was routed through a load balancer, you must analyze the "X-Forwarded-For" header entry in the HTTP protocol. To do so, install and activate the "Advanced Logging" IIS add-on:

Prerequisites:

You have logged in to the server as an administrator.

Please note:
For technical reasons, these instructions work only for unencrypted connections.
Step 1
Install the Advanced Logging IIS add-on on your web servers.
Step 2
Open the (IIS) Manager.
Step 3
In the left navigation bar, under Connections, select the server or site for which you want to change the logging settings.
Step 4
In the IIS section, double-click Advanced Logging.
Feature-Icon
Feature-Icon
Step 5
In the right navigation bar, click Edit Logging Fields in the Actions section.
Step 6
Click Add Field.

The Add Logging Field window is displayed.

Step 7
In the Field ID field, enter Forwarded-For.
Step 8
In the Category list, select the Default entry.
Step 9
In the Source type list, select the request header entry.
Step 10
In the Source name field, enter X-Forwarded-For. Logging field window
Logging field window
Step 11
Click OK.
Step 12
Click OK.
Step 13
Select the log definition %COMPUTERNAME%-Server
Step 14
In the right navigation bar, click Edit Log Definition from the Actions section.
Step 15
In the Selected Fields section, click Select Fields.
Step 16
Activate the Forwarded-For entry. Logging field window
Logging field window
Step 17
Click OK.
Step 18
In the right navigation bar, click Apply in the Actions section.
Step 19
In the left navigation bar in the (IIS) manager, select the relevant server in the Connections section.
Step 20
In the IIS section, double-click Advanced Logging.
Step 21
In the right navigation bar, click Enable Advanced Logging in the Actions section.

Advanced Logging has been activated.

For additional information, you may want to reference: