String ipAddress = ApexPages.currentPage().getHeaders().get(‘X-Salesforce-SIP’);
‘True-Client-IP’ – when the request is coming via the caching integration.
‘X-Salesforce-SIP’ – when the request is not via caching integration (sandbox, developer edition orgs) or via the secure url.
2 thoughts on “How to get the Ip Address of User using Apex in Salesforce?”
Could you please explain more, what do you mean by caching integration.???
caching integration – sandbox, developer edition orgs.