HTTP proxy cannot be configured for Apache HttpClient 4 using system properties
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
- Apache HttpClient
- 4.3
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
