Proxy settings http.proxyHost and http.proxyPort ignored by Java? 


December 03, 2013 09:14:45    Last update: December 03, 2013 09:14:45
To test the effects of proxy settings http.proxyHost and http.proxyPort, I set these values to a non-existing proxy server:
java -Dhttp.proxyPort=8 GetPage

To my surprise, the Google is retrieved successfully! Is Java ignoring these settings?

It turns out that Java tries to fetch the URL directly after the proxy connection fails. If a working proxy is found at proxyHost:proxyPort, then the request is routed through the proxy, otherwise a direct connection is tried.

The settings are documented here:

For HTTPS use these properties:
  • htttps.proxyHost
  • htttps.proxyPort
Share |
| Comment  | Tags