Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8144300

Java does not honor http.nonProxyHosts value having wildcard * both at end and start

    Details

    • Subcomponent:
    • Resolved In Build:
      b07
    • CPU:
      x86
    • OS:
      windows_2008

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 2008 R2 SP1 x84

      A DESCRIPTION OF THE PROBLEM :
      Java programs does not honor http.nonProxyHosts value having wildcard * at end as shown:

      http.nonProxyHosts="*.google.*"


      Connections to say www.google.com still via Proxy rather than going Direct.




      REGRESSION. Last worked in version 8u60

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Install a simple Proxy Server in a machine

      2) Compile and run the source code given below in another machine (not the Proxy machine) with following argument:

      java -Dhttps.proxyHost=10.**.*.*** -Dhttps.proxyPort=808 -Dhttp.nonProxyHosts="*.google.*" testProxy.ProxyTest








      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      "https://www.google.com" connection traffic must not go via Proxy, it should go via Direct connection
      ACTUAL -
      "https://www.google.com" connection traffic still goes via Proxy

      Proxy logs show CONNECT :

      15:53:14 Unknown 10.75.3.180 CONNECT www.google.com:443 HTTP/1.1 HTTPS outgoing via 10.**.*.***

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package testProxy;

      import java.io.BufferedReader;
      import java.io.IOException;
      import java.io.InputStreamReader;
      import java.net.HttpURLConnection;
      import java.net.URL;

      /**
       * Example:
       *
       * java.exe -Dhttps.proxyHost=10.11.1.111 -Dhttps.proxyPort=808 -Dhttp.nonProxyHosts="*.google.*" testProxy.ProxyTest
       */
      public class ProxyTest {

      /**
      * @param args
      * @throws IOException
      */
      public static void main(String[] args) throws IOException {

      String url = "https://www.google.com";

      URL obj = new URL(url);
      HttpURLConnection con = (HttpURLConnection) obj.openConnection();
      con.setRequestMethod("GET");
      int responseCode = con.getResponseCode();
      System.out.println("\nSending 'GET' request to URL : " + url);
      System.out.println("Response Code : " + responseCode);

      BufferedReader in = new BufferedReader(
      new InputStreamReader(con.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();

      while ((inputLine = in.readLine()) != null) {
      response.append(inputLine);
      }
      in.close();


      System.out.println("Response: \n" + response.toString());
      }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      None available

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psonal Pallavi Sonal
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: