ECS: How To Configure "X-Forwarded-For" for ECS with Load Balancer

Summary: The steps provided below enable "X-Forwarded-For" within ECS so if a load balancer has been configured to pass the originating IP address through - ECS will also capture that in the log file. ...

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

When using a load balancer like F5's Big IP with ECS, there is an ability to pass along the originating IP address through so it shows in the ECS log files. 
Note:  This will only work if "X-Forwarded-For" has been enabled on the load balancer. (See further details below)*.

Steps to enable X-Forwarded-For within ECS. 

1. Secure shell on to an ECS node as admin.

2. Run the following command to check if the parameter was set before. 
Command: #
svc_param info com.emc.ecs.objheadsvc.request_log.headers

Example 1: If it was never set before, see the below output. 

admin@ecsnode1:~> svc_param info com.emc.ecs.objheadsvc.request_log.headers
svc_param v1.2.2 (svc_tools v2.11.1)                 Started 2023-07-31 18:13:45


Param: com.emc.ecs.objheadsvc.request_log.headers

  Description                     comma sep list of headers to log
  Default value (active)
  Configured Value                < Never modified >
  Modification reason             None
  Last modified                   None

Example 2:  The below sample indicates that the parameter was set before. 

admin@ecsnode1:~>  svc_param info com.emc.ecs.objheadsvc.request_log.headers
svc_param v1.2.2 (svc_tools v2.11.1)                 Started 2023-07-31 18:15:05

WARNING   Could not get REST auth token from IP '127.0.0.1' - Connection failed

Param: com.emc.ecs.objheadsvc.request_log.headers

  Description                     comma sep list of headers to log
  Default value
  Configured Value (active)       X-Forwarded-For
  Modification reason             log request source ip address
  Last modified                   2023-07-31 18:14:32 UTC (1690827272918)


3. Run the following command to enable X-Forwarded-For.
Command:  #svc_param set -n com.emc.ecs.objheadsvc.request_log.headers -v "X-Forwarded-For" -r "log request source ip address"

Example: Parameter change

admin@ecsnode1:~> svc_param set -n com.emc.ecs.objheadsvc.request_log.headers -v "X-Forwarded-For" -r "log request source ip address"
svc_param v1.2.2 (svc_tools v2.11.1)                 Started 2023-07-31 18:14:32

Param value changed.

Param: com.emc.ecs.objheadsvc.request_log.headers

  Description                     comma sep list of headers to log
  Default value
  Configured Value (active)       X-Forwarded-For
  Modification reason             log request source ip address
  Last modified                   2023-07-31 18:14:32 UTC (1690827272918)


4. To verify the command setting has been set, run the following command. 

admin@ecsnode1:~>  svc_param info com.emc.ecs.objheadsvc.request_log.headers
svc_param v1.2.2 (svc_tools v2.11.1)                 Started 2023-07-31 18:15:05

Param: com.emc.ecs.objheadsvc.request_log.headers

  Description                     comma sep list of headers to log
  Default value
  Configured Value (active)       X-Forwarded-For
  Modification reason             log request source ip address
  Last modified                   2023-07-31 18:14:32 UTC (1690827272918)


Notes:

  1. You only need to run the configuration change on one node. It should take effect immediately.
  2. No need to restart any services. 
  3. There is no impact from setting this parameter 
  4. To confirm the forwarding works, check the dataheadsvc.log file RequestLog.java in the dataheadsvc.log
Command:  #svc_log -f 'X-Forwarded-For' -sr dataheadsvc-access -start 10m 
Example: This is one sample log line including the Forwarded client IP.
2017-03-13T14:57:38,591 [qtp947043383-731114]  INFO  RequestLog.java (line 83) 10.XXX.134.55 GET //10.XXX.134.55:9024/v1/9f2f0506dc2748ba98b52904ca44f89a?format=json&marker=test-storage-16228-255 HTTP/1.0 200 865 - 3 'X-Forwarded-For: 10.XXX.134.56'


Load Balancer Details:
This feature will only work when the load balancer has been properly configured. 

F5 BigIP has been tested in the lab.  

For example, with the F5 BigIP Load Balancer - the key is setting ProxyPreserveHost on and making sure that you enable the x-forwarded-for in the HTTP profile.  
The following link is provided for a review on how to configure F5 BIG-IP:
https://support.f5.com/csp/article/K4816This hyperlink is taking you to a website outside of Dell Technologies.

 

Affected Products

Elastic Cloud Storage

Products

Elastic Cloud Storage
Article Properties
Article Number: 000013873
Article Type: How To
Last Modified: 24 Apr 2025
Version:  8
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.