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?