Skip to main content
I'm trying to make an HTTP Request to other System.

They provided the endpoint URL which contains a Port number.

https://Test.com:50001/RESTAP/BGN/PRDV/CREATE

When I'm trying to make the request I facing with this ERROR:

> System.CalloutException: Unable to tunnel through proxy. Proxy returns

> "HTTP/1.1 503 Service Unavailable"

although I have added the URL in remote sites.

When I make the request from Postman - I get the response as expected.

My code is : 

    Http httpProtocol = new Http();

            HttpRequest request = new HttpRequest();

            String url = 'https://Test.com:50001/RESTAP/BGN/PRDV/CREATE';

            String username2 = 'Name';

            String password2 = 'Passowrd';

            Blob headerValue = Blob.valueOf(username2 + ':' + password2);

            String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);

            request.setEndpoint(url);

            request.setMethod('POST');

            request.setHeader('Authorization', authorizationHeader);

            request.setTimeout(60000);

    

    

            request.setHeader('Content-Type','application/json');

            request.setHeader('proxyPort','50001');

            request.setHeader('proxyHost','PROXYHOST URL');

            request.setHeader('proxySet','true');

    

            HttpResponse response = httpProtocol.send(request);

Note: The userName and Password will be filled from Custom setting.

I tried with and without the proxy header, I tried to turn the BASIC auth to Basic and many other little changes that didn't work.

I'm still getting this Error.

How can I know if it not blocked by Firewall? 

Any help or Idea to solve this issue

Thanks!
10 个回答
0/9000