13

So I have a fairly loaded env variable for _JAVA_OPTIONS

export _JAVA_OPTIONS="-Dhttp.proxyHost=my-proxy.com -Dhttp.proxyPort=1080 
  -Dhttps.proxyHost=my-proxy.com -Dhttps.proxyPort=1080 
  -DsocksProxyHost=my-socks-proxy.com 
  -Dhttp.nonProxyHosts=\"localhost|127.0.0.1|*.local|*.my-co.com\""

However I couldn't get it to ignore an internal server url when I tried it from Scala code using Apache HTTP client API.

https://username:pwd@server.my-co.com/foo/bar

Do I need to specify a different nonProxyHosts for HTTPS? The documentation didn't specify such a parameter. What am I missing? I am on a Mac.

Bob
  • 8,424
  • 17
  • 72
  • 110
  • According to http://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html#Proxies the `http.nonProxyHosts` proxy setting is the correct property for HTTPS. In the same document there is a SOCKS paragraph that reads: `setting a SOCKS proxy server will result in all TCP connections to go through that proxy, unless other proxies are specified.` Should `my-co.com` be accessed through `my-socks-proxy.com` or `my-proxy.com`? – jaume Jan 28 '15 at 13:24

1 Answers1

10

This answer is for the main question, and for whatever reason I originally thought this was ColdFusion specific.

It is rarely documented, but there is an https non proxy host argument you can use:

-Dhttps.nonProxyHosts=

A lot of documentation states that -Dhttp.nonProxyHosts will cover both. For example, that is the case in Coldfusion. In other cases, say Weblogic, you have to have both arguments, both the http and https versions.

For ColdFusion, he reason it doesn't work is that ColdFusion is adding quotes to the -Dhttp.nonProxyHosts argument:

-Dhttp.nonProxyHosts="my-server"

If you don't use quotes you should be good:

-Dhttp.nonProxyHosts=my-server
Cavva79
  • 379
  • 6
  • 17
Randolph Abeyta
  • 424
  • 3
  • 8
  • 15
    There is no such thing as `https.nonProxyHosts`. The [documentation](https://docs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties.html) says `The HTTPS protocol handler will use the same nonProxyHosts property as the HTTP protocol.` – artbristol Feb 12 '18 at 11:27
  • 3
    Apparently, there _is_ such thing on Weblogic, which does not care about the documentation. – 0x5C91 Jun 05 '20 at 17:45
  • Oracle Java SE documents the use of the nonProxyHosts option so it is supported. In my case I had to use quotation marks around the option value. See https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html – Ioannis K. Moutsatsos Aug 09 '23 at 18:07