How can I read IP address of the HTTP client?

54 views
Skip to first unread message

Everton Marques

unread,
Jun 16, 2016, 2:15:49 PM6/16/16
to gowebuitoolkit
How can I read IP address of the HTTP client?

Thanks,
Everton

Everton Marques

unread,
Jun 16, 2016, 5:12:48 PM6/16/16
to gowebuitoolkit
Because I failed to find the API for reading HTTP client address, I am considering this change:


Does it make sense?

Thanks,
Everton

András Belicza

unread,
Jun 17, 2016, 12:12:35 AM6/17/16
to gowebuitoolkit
Currently the `http.Request` is not exposed in event handlers.

Your proposed change is not the right one. You tried to bound/store IP in the session, but even the same client may use multiple IPs during the same session (even from the same computer), so the IP is not a property of the session.

IP may change from request to request.

Everton Marques

unread,
Jun 17, 2016, 9:51:40 AM6/17/16
to gowebuitoolkit
I suppose you meant the client IP address might get changed while the session cookie is kept by the client agent, right?

All I actually need is to record the most recently seen client IP address, in order to write an audit log including <timestamp, username, ip-address>.

Of course, it would be much better to have a sane API for querying the client "current" IP address.

András Belicza

unread,
Jun 17, 2016, 10:15:58 AM6/17/16
to gowebuitoolkit
That's what I'm gonna do. I created an issue for that:


Regards,
Andras


On Thursday, June 16, 2016 at 8:15:49 PM UTC+2, Everton Marques wrote:
Reply all
Reply to author
Forward
0 new messages