We are developing hybrid application using WL6.2. In our adapter we have this code:
var request = WL.Server.getClientRequest();
var IPAddress = request.getHeader('X-Archieved-Client-IP');
if(IPAddress == null || IPAddress == undefined || IPAddress == "") {
IPAddress = request.getHeader('X-Archieved-Client-IP');
}
if(IPAddress == null || IPAddress == undefined || IPAddress == "") {
IPAddress = request.getRemoteAddr();
}
if(IPAddress == null || IPAddress == undefined || IPAddress == "") {
//This will never happen, only for precaution.
IPAddress = "192.168.1.1";
}
commonParams.originatingIp = (IPAddress)?IPAddress:request.getRemoteAddr();
I'm not able to get the client IP address on the adapter, and our web services only see one IP address which is the Data power IP.And In the logs I see our Data power IP address as "orginatingIP". which means "getRemoteAddr()"
is being executed.
<OriginatingIP>DataPowerIP</OriginatingIP>
If I kept only this part of code:
var request = WL.Server.getClientRequest();
var IPAddress = request.getHeader('X-Archieved-Client-IP');
commonParams.originatingIp = IPAddress;
I'm getting value as "null".
<OriginatingIP>null</OriginatingIP>
I tried also this solution "IBM Worklight 6 - How would i get client IP address on adapter side" also didn't work.
any suggestions please? thanks