How to "truly" get IP Address of HTTP Client

Hi,

How can I get the IP Address of an http client.

  1. I am using TROIndyHTTPServer on a datamodule
  2. I have descendants of TROExtendedHttpDispatcher which respond to post/get to various paths and are tied to the instance of TROIndyHTTPServer on the datamodule.
  3. I have searched through the code and there is no simple easy way to achieve this without deriving a new class because the code that processes the request hides the Indy object deep before the Process code in my TROExtendedHttpDispatcher is called.
    a) uROIndyHTTPServer -> TROIndyHTTPServer.InternalServerCommandGet -> ProcessRequest

I have searched and all answers assume I am using a kind of message (Binary, JSON, etc) component or using the RO SDK Service modules.

Environment:
Delphi XE2
RO 6.
Windows 7

Any pointers would be appreciated.

Kind regards

Hi there

Sorry I do not know the answer to your question but here something that comes to my mind -> If you have someting like a loadbalancer or proxy in front of your RO app, you might be able to use the “X-Forwarded-For” request header field:

Cheers,
Peter

Hello,

Add the following method into your service:

procedure TNewService.RORemoteDataModuleGetDispatchInfo(
const aTransport: IROTransport; const aMessage: IROMessage);
var tcpinfo:IROTCPtransport;
begin
if Supports(aTransport, IROTCPtransport, tcpinfo) then
begin
//Log(‘Client ’ + tcpinfo.GetClientAddress + ’ connected!’);
end;
end;

1 Like