We're occasionally seeing cgi.remote_addr come thr...
# cfml-general
d
We're occasionally seeing cgi.remote_addr come through as 'unknown', just wondering why/how this happens?
b
What CF engine?
What servlet container?
In most cases, the CF engine's defer to the HttpServletRequest object like so
Copy code
request.getRemoteAddr()
So it's provided by Tomcat, et al
I would start by calling that method on the actual servlet request (you can get from the page context) to see if it is coming form the servlet that way
and then inspect the HTTP request headers for clues.
Specifically any
x-forwarded-for
header, which could be overwriting it
b
Hi Dave, Looks like Brad beat me to it :) Without knowing more detail about your web server, I would first check the availability of cgi.http_x_forwarded_for. If it is available use that, otherwise use cgi.remote_addr. Hope that helps.
d
We're using ACF2023 (standard install), IIS10, Win 2022.
b
A value of "unknown" for
cgi.remote_addr
seems odd. You would expect an IP address or an empty string. Does your server do DNS lookup, for example, by means of the attribute
enableLookups="true"
in the connectors in
server.xml
? If so, switch over to
<connector ... enableLookups="false" />
and see what happens.