5 Replies Latest reply on Nov 14, 2008 2:36 AM by ron_sigal

    Using proxy for localhost

    mproch

      Hello,
      I have a question about http proxies with jboss remoting.
      I am enabling http proxy (running on my localhost) by setting system properties:

      -DproxySet=true -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8081
      

      It works fine, unless I want to access localhost/127.0.0.1 - then the proxy is not used.
       InvokerLocator clientLocator = new InvokerLocator("http://<host>:8080/sth");
       Client client = new Client(clientLocator);
       client.connect();
       client.invoke("stupidTestString");
      
      

      When I replace 'host' with 'localhost' or '127.0.0.1' - the proxy is not used. If I replace it with 'ws' - which has entry in my etc/hosts file pointing to 127.0.0.1 - the proxy is used...

      Is it desired behaviour - and if so, can I change it (i.e. so that connection to 'localhost' uses proxy)?

      thx


        • 1. Re: Using proxy for localhost
          jaikiran

          Can you post the output of the following from your code:


          String nonProxyHosts = System.getProperty("http.nonProxyHosts");
          System.out.println("Wont use proxy for : " + nonProxyHosts);


          • 2. Re: Using proxy for localhost
            mproch

            It says:

            Wont use proxy for : null
            

            - so I guess it's not this one...

            • 3. Re: Using proxy for localhost
              jaikiran

              The reason i asked you to post that output is to ensure that you had not unitentionally set the bypass proxy for localhost through the http.nonProxyHosts system property. Your settings look correct to me.

              • 4. Re: Using proxy for localhost
                jaikiran

                 

                "mproch" wrote:

                When I replace 'host' with 'localhost' or '127.0.0.1' - the proxy is not used. If I replace it with 'ws' - which has entry in my etc/hosts file pointing to 127.0.0.1 - the proxy is used...



                How are you testing this? I mean how do you come to know that the proxy is not being used? I am trying reproduce this on my local setup.


                • 5. Re: Using proxy for localhost
                  ron_sigal

                  Just so I understand, you're saying that if you

                  * have a Remoting server running at localhost:8080

                  * have a proxy server running at localhost:8081

                  * create InvokerLocator "http://localhost:8080/sth" on the client

                  * specify system properties -Dhttp.proxyHost=localhost and -Dhttp.proxyPort=8081

                  the invocation goes directly to the Remoting server?