function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
aditya prasadaditya prasad 

Get error: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 404 Not Found"

I need to read some data from an external site and once I get respnse, will update records based on the data.
My code:
         Accolade__c accoladeSettings = Accolade__c.getOrgDefaults();
         HTTP h = new HTTP();
         HTTPRequest r = new HTTPRequest();
         Blob headerValue = Blob.valueOf(accoladeSettings.Username__c + ':' + accoladeSettings.Password__c);
         String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
         system.debug('Authorization header'+headerValue);
         r.setHeader('Authorization', authorizationHeader);
         String baseEndPoint = accoladeSettings.Url1__c;
         baseEndPoint +='9726'+accoladeSettings.Url2__c;
         HTTPResponse resp = new HTTPResponse();
         resp = h.send(r);

But I get Unable to tunnel through proxy. Proxy returns "HTTP/1.0 404 Not Found" for  resp = h.send(r);
I have asked thirdparty to whitelist salesforce Ips. 
But is there any other way we can overcome this error. How to achieve same functionality using SOAP? I am unawarte of SOAP, any help is very much appreciated.

Is your baseEndPoint a valid REST EndPoint?
aditya prasadaditya prasad
Yes it is, I can directly put the url and get the JSON/XML file. As far I know , its due to their firewall protection or something like that, which doesn't allow us to go through it from salesforce. They need to whitelist salesaforce IPs. May be this can help. But is there any other way, where we don't require IPs to be whitelisted.?

You don't have to whitelist the IP address in Salesforce unless you consume the Salesforce API from a 3rd Party application.

You have to use either a Named Credential or add the EndPoint URL to Remote Site Settings under "Security Controls" to make it available for Salesforce.

Let me know if this helps.
aditya prasadaditya prasad
I have already done these things.You can see above I am passing user name password for authentication.
And also added under Remote Site setting as well. If don't add it , it will ask me to add it. So that is not an issue.
aditya prasadaditya prasad
The URL I am trying to access is a SSO link. Do I need to take extra care for that ?