+ Start a Discussion
shikher goelshikher goel 

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

Hi All,

I am trying to fetch the Salesforce Objects Schema from some other Sandbox. To achieve this ,i am trying to connect salesforce with REST API using this below code :
      Http h = new Http();
      HttpRequest request= new HttpREquest();
      String endPointURL = 'https://c.cs15.salesforce.com/services/data/v34.0/sobjects';
      request.setHeader('Authorization', 'Bearer '+ UserInfo.getSessionId());
      request.setEndPOint(endPointURL );
      request.setbody(endPointURL );
      HttpResponse hres = h.send(request);
      response = hres.getBody();
      }catch(exception exc)
       system.debug('EXc is '+exc);
       response = exc.getMessage();

 But I am getting the error as "Unable to tunnel through proxy. Proxy returns "HTTP/1.0 404 Not Found".
As far I know this is because of firewalls.but i want to add proxy into my code.
Can someone know,how can we add proxy in apex.???
ShashankShashank (Salesforce Developers) 
You cannot add rpoxy in apex code. You willl have to work with your network team to allow salesforce through the firewall. Please see if this helps: