You are not logged in.
Pages: 1
Hi Arnaud,
i try to get RemoteIP in MVC Server.
I set RemoteIPServer either to X-Real-IP or X-Forwarded-For.
But how can i access/Request RemoteIP from function in MVC-Server ?
i tried it this way:
function TMyMVCApplication.GetCallerIPAdresse: RawUtf8;
begin
Result := FindIniNameValue(pointer(ServiceRunningContext.Request.Call.InHead), 'REMOTEIP: ');
if Length(Result) = 0 then
Result := ServiceRunningContext.Request.Call.LowLevelRemoteIP;
if Length(Result) = 0 then
Result := '127.0.0.1';
end;
But RemoteIP is empty
Thank you
Rad Studio 12.3 Athens
Offline
My guess is that there is something wrong in the RemoteIPHeader value process.
I will investigate.
Edit: There was a bug: https://github.com/synopse/mORMot2/commit/40333d514
Try to debug THttpServerGeneric.ParseRemoteIPConnID() to see why the proxy header is not found.
Also note that FindNameValue() is preferred to FindIniNameValue() for parsing HTTP headers.
Offline
Pages: 1