Graham Barnard

What's My Salesforce IP Address?

Introduction

Featured

Development

What's My Salesforce IP Address?

Posted by Graham Barnard on .

IP whitelisting is an effective method to help secure connections to external environments. Salesforce provides a range of IPs addresses that can be whitelisted by external systems based on your Salesforce region. Salesforce recommends whitelisting the entire set of IP ranges.

Runs this Apex code from Execute Anynomous to find your current IP adresss.

NOTE: This will only work when you add https://api.ipify.org to your remote site settings.

The Code


String url = 'https://api.ipify.org';

// Pass in the endpoint to be used using the string url
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('GET');

// Send the request,
HttpResponse res = h.send(req);
String responseBody = res.getBody();

System.debug('Current Ip Address: ' + responseBody);

This code might help troubleshoot an issue, but you cannot guarantee that this will always be your IP address as Salesforce might randomly change it.

user

Graham Barnard

http://grahambarnard.com

Senior Salesforce Developer