1

My coldfusion web app is located behind a load balancer. I need to get the user's ip address. I have used the following but I am still not getting the user's ip but the load balancer's ip.

My Coldfusion version is 10.

<cfif StructKeyExists(GetHttpRequestData().headers, "X-Forwarded-For") >
<cfset ip = Trim(ListFirst(GetHttpRequestData().headers["X-Forwarded-For"]))  > 
<cfelse>
<cfset ip = CGI.REMOTE_ADDR >
</cfif> 

The GetHttpRequestData().headers does not contain X-Forwarded-For.

Is there anything that I am missing? Have you experienced the same?

halfer
  • 19,824
  • 17
  • 99
  • 186
rob
  • 715
  • 2
  • 6
  • 20
  • 5
    You have to configure your load balancer to pass that information through to the backend servers. – Miguel-F Jan 09 '17 at 13:41

0 Answers0