---
title: Configuring traffic through a load balancer
description: Record the actual client IP address in PingDirectory logs when traffic passes through a load balancer by enabling forwarded header handling.
component: pingdirectory
version: 11.0
page_id: pingdirectory:pingdirectory_server_administration_guide:pd_ds_config_traffic_through_load_balancer
canonical_url: https://docs.pingidentity.com/pingdirectory/11.1/pingdirectory_server_administration_guide/pd_ds_config_traffic_through_load_balancer.html
llms_txt: https://docs.pingidentity.com/pingdirectory/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
revdate: September 13, 2023
page_aliases: ["pd_ds_config_traffic_load_balancer_dsconfig.adoc", "pd_ds_config_traffic_load_balancer_admin_console.adoc"]
superseded_by: https://docs.pingidentity.com/pingdirectory/11.1/pingdirectory_server_administration_guide/pd_ds_config_traffic_through_load_balancer.html
section_ids:
  configuring-traffic-through-a-load-balancer-using-dsconfig: Configuring traffic through a load balancer using dsconfig
  about-this-task: About this task
  steps: Steps
  example: Example:
  example-2: Example:
  configuring-traffic-through-a-load-balancer-using-the-admin-console: Configuring traffic through a load balancer using the admin console
  about-this-task-2: About this task
  steps-2: Steps
  example-3: Example:
---

# Configuring traffic through a load balancer

To record the actual client's IP address to the trace log, enable `X-Forwarded-*` handling in both the intermediate HTTP server and the PingDirectory server.

By default, when a PingDirectory server is sitting behind an intermediate HTTP server, such as a load balancer, a reverse proxy, or a cache, it logs incoming requests as originating with the intermediate HTTP server instead of the client that sent the request.

When you set the `use-forwarded-headers` property and enable an HTTP connection handler to use `Forwarded` or `X-Forwarded-*` headers, many intermediate HTTP servers add information about the original request that would otherwise be lost.

If `use-forwarded-headers` is set to `true`, the server uses the client IP address and port information in the `Forwarded` or `X-Forwarded-*` headers instead of the address and port of the entity that's sending the request (the load balancer). This client address information shows up in logs, such as in the `from` field of the `HTTP REQUEST` and `HTTP RESPONSE` messages.

|   |                                                                                                                                                                                                                                                            |
| - | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | If both the `Forwarded` and `X-Forwarded-*` headers are included in the request, the `Forwarded` header takes precedence. The `X-Forwarded-Prefix` header only overrides the context path for HTTP servlet extensions, not for web application extensions. |

## Configuring traffic through a load balancer using `dsconfig`

### About this task

To configure the directory server to get traffic through a load balancer and to record the actual client's IP address:

### Steps

1. Edit the HTTP or HTTPS connection handler object and set `use-forwarded-headers` to `true` by running `dsconfig`.

   #### Example:

   ```
   dsconfig set-connection-handler-prop \
       --handler-name "HTTPS Connection Handler" \
       --set use-forwarded-headers:true
   ```

2. To finalize the changes to the HTTP or HTTPS connection handler, use `dsconfig` to restart the connection handler.

   #### Example:

   ```
   dsconfig set-connection-handler-prop \
       --handler-name "HTTPS Connection Handler" \
       --set enabled:false

   dsconfig set-connection-handler-prop \
       --handler-name "HTTPS Connection Handler" \
       --set enabled:true
   ```

3. To provide the `X-Forwarded-*` information to your load balancer, consult your provider's guide on configuring the load balancer settings.

## Configuring traffic through a load balancer using the admin console

### About this task

To configure the PingDirectory server to get traffic through a load balancer and to record the actual client's IP address:

### Steps

1. On the PingDirectory admin console **Configuration** page, click **Connection Handlers**.

2. To edit your HTTP or HTTPS connection handler, in the **Connection Handlers** list, select the connection handler you want to edit.

3. To enable `Forwarded` headers, go to **Use Forwarded Headers** and select the **Enabled** check box.

4. Click **Save**.

5. To finalize the changes to the HTTP or HTTPS connection handler, use `dsconfig` to restart the connection handler.

   #### Example:

   ```
   dsconfig set-connection-handler-prop \
       --handler-name "HTTPS Connection Handler" \
       --set enabled:false

   dsconfig set-connection-handler-prop \
       --handler-name "HTTPS Connection Handler" \
       --set enabled:true
   ```

   |   |                                                                                                                                                       |
   | - | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
   |   | Because disabling the connection handler brings down the admin console, you must complete this step in the command line instead of the admin console. |

6. To provide the `X-Forwarded-*` information to your load balancer, consult your provider's guide on configuring the load balancer settings.
