Public IP recorded in SC log

Hi
The IP address recorded in the sc_log table is the information obtained from $_SERVER[‘REMOTE_ADDR’].
In my case I have a reverse proxy, so the correct information is in $_SERVER[‘HTTP_X_FORWARDED_FOR’].

Does anyone know how to change this information?
regards.

You can override the IP logging behavior in your applications by customizing the value before it gets written to the sc_log table.

Option 1: Set the correct IP manually in onApplicationInit

In your application (e.g., login or main form), add the following code in the onApplicationInit event:
if (!empty($_SERVER[‘HTTP_X_FORWARDED_FOR’])) {
$_SERVER[‘REMOTE_ADDR’] = $_SERVER[‘HTTP_X_FORWARDED_FOR’];
}

Thanks!
I’ll try and will get back

i maybe wrong, but I think $_SERVER[‘REMOTE_ADDR’] will be set by the web server at each browser’s request, so overwriting it once at application login will not accomplish much.

but also, I could be wrong and it could work.