2

I'm perfoming a HTTP GET callout to an external cURL connected through proxy, using Postman i get the response. However, while making callout from Salesforce, it gives the following error:

System.CalloutException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 503 Service Unavailable"

I have whitelisted the Salesforce IP addresses in the external system and added the endpoint URL in remote site settings.

Here is my code:

Http http = new Http();
HttpRequest request = new HttpRequest();
String endpoint = 'https://username:password@mycURL';
request.setEndpoint(endpoint);
request.setMethod('GET');
HttpResponse response = http.send(request);

Am I missing something else? What could be the issue?

Thanks in advance

1 Answer 1

3

I don't believe that syntax is supported. Instead, you could use Basic authentication:

Http http = new Http();
HttpRequest request = new HttpRequest();
String endpoint = 'https://mycURL';
request.setEndpoint(endpoint);
request.setMethod('GET');
request.setHeader(
  'Authorization',
  'Basic '+EncodingUtil.base64Encode(Blob.valueOf('username:password'))
);
HttpResponse response = http.send(request);
2
  • Hi, thanks a lot for your reply! I've tried your script but it didn't work. I get still the same error message. We had a look at the SSL certificates supported by Salesforce and everything looks fine: help.salesforce.com/… Feb 24, 2020 at 8:34
  • @AntoninoCupi Not sure what else to say. It could be a DNS issue, or perhaps there's some security configuration on the service that restricts access? I'm pretty sure you'd get a different error if it was a SSL cert problem.
    – sfdcfox
    Feb 24, 2020 at 14:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .