HTTP proxy cannot be configured for Apache HttpClient 4/5 using system properties

Solution Unverified - Updated -

Issue

  • I have a web application in JBoss trying to call an external web service through an HTTP proxy using Apache HttpClient 4.3.3.
  • I have tried the following settings to no avail:
  • In standalone.sh:

    JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=proxy.sample.com -Dhttp.proxyPort=7070"
    
  • In standalone.xml:

    <system-properties>
        <property name="http.proxyHost" value="proxy.sample.com"></property>
        <property name="http.proxyPort" value="7070"></property>
        <property name="http.nonProxyHosts" value="localhost"></property> 
    </system-properties>
    
  • And also in environment:

    HTTP_PROXY=proxy.sample.com:7070
    http_proxy=proxy.sample.com:7070
    
  • After approximately 60 seconds I get "ERROR 500: Internal Server Error".

  • My application code looks like this:

    CloseableHttpClient httpclient = HttpClients.createDefault();
    URI uri = ...
    HttpGet httpget = new HttpGet(uri);
    CloseableHttpResponse response = httpclient.execute(httpget);
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x
    • 7.x
  • Apache HttpClient
    • 4.3+
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content