You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Junseok (Jira)" <ji...@apache.org> on 2020/07/28 15:36:00 UTC

[jira] [Created] (AMBARI-25538) Property -Dhttp.proxyHost doesn't work when install HDP.

Junseok created AMBARI-25538:
--------------------------------

             Summary: Property -Dhttp.proxyHost doesn't work when install HDP.
                 Key: AMBARI-25538
                 URL: https://issues.apache.org/jira/browse/AMBARI-25538
             Project: Ambari
          Issue Type: Bug
          Components: ambari-sever
    Affects Versions: 2.7.5
            Reporter: Junseok
             Fix For: 2.7.4


There is Problem that the Proxy Setting doesn't work in Ambari-server 2.7.5 even if pass system properties -Dhttp.proxyHost and -Dhttp.proxyPort.

I find the reason. During URLRedirectProvider.buildHttpClient() build httpClient, no code inherited java system properties relevant HTTP.

The ambari 2.7.4 is fine. Since ambari 2.7.4 use *HttpURLConnection* to load VDF.XML, the proxy property (http.proxyHost, http.proxyPort) is passed for HTTP Request and It is fine.

Here is sample code to be inherited system properties when build httpClient.
{code:java}
public static String executeGet(String spec, boolean useSystemProperty) throws Exception {
   CloseableHttpClient httpClient = useSystemProperty ?
         builder.useSystemProperties().build() : HttpClientBuilder.create().build();

   HttpGet httpGet = new HttpGet(spec);
   CloseableHttpResponse response = httpClient.execute(httpGet);

   final InputStream is = response.getEntity().getContent();
   return IOUtils.toString(is, StandardCharsets.UTF_8);
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)