title: Glassfish 4.1 configure http/https proxy
body: <p>To access external endpoints I have to go through proxy server. I have been trying to configure the http and https proxy in my glassfish 4.1 server but have had no success. I've tried adding the following sets of Java Options in my domain.xml - manually and through UI. But am still getting "Network is unreachable; nested exception is java.net.SocketException: 
  Network is unreachable" error. </p>
  
  <pre><code>    &lt;jvm-options&gt;-Djava.http.proxyHost=proxy.domain.com&lt;/jvm-options&gt;
      &lt;jvm-options&gt;-Djava.http.proxyPort=3128&lt;/jvm-options&gt;
      &lt;jvm-options&gt;-Djava.https.proxyHost=proxy.domain.com&lt;/jvm-options&gt;
      &lt;jvm-options&gt;-Djava.https.proxyPort=3128&lt;/jvm-options&gt;
      **********************************************************************
      &lt;jvm-options&gt;-Dhttp.proxyHost=proxy.domain.com&lt;/jvm-options&gt;
      &lt;jvm-options&gt;-Dhttp.proxyPort=3128&lt;/jvm-options&gt;
      &lt;jvm-options&gt;-Dhttps.proxyHost=proxy.domain.com&lt;/jvm-options&gt;
      &lt;jvm-options&gt;-Dhttps.proxyPort=3128&lt;/jvm-options&gt; 
  </code></pre>
  
  <p>When I check the process (ps -ef | grep java) I can see the Java Options have been applied. I also need to implement http.nonProxyHosts ( something like  -Dhttp.nonProxyHosts= *.mydomain.com|localhost ) since some are internal endpoints and need to escape the proxy. But that's the second battle. Any help on this would be very much appreciated.</p>
  
  <p><a href="https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html" rel="nofollow noreferrer">https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html</a></p>