2 Replies Latest reply on Aug 6, 2011 1:48 PM by fharms

    How do I get HTTP invoker to return an proxy attached to the same port as requested

    fharms

      I'm having hard time to get the HttpNamingContextFactory work properly.

       

      My server is setup so it only allow communication through port 80 and has an Apache in front of my JBoss 5.1 server. The JBoss Web server is listen on port 8080 and AJP on 8009 and the Apache is setup to forward it's request to the JBoss server

       

      I know the link between the Apache and JBoss is working, but when I create the initial context on the client with HttpNamingContextFactory it return an context with an proxy which point to the internal JBoss Web server port and not the public port 80

       

      Any ideas how to solve this? Thanks!

       

      Hashtable<String, String> env = new Hashtable<String, String>();

       

      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory");

      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");

      env.put(Context.PROVIDER_URL, "http://"+host+"/invoker/JNDIFactory");

      return new InitialContext(env);

       

      return :

       

      org.jboss.invocation.http.interfaces.HttpInvokerProxy@71ec068c(externalURL:http://x.x.x.x:8080/invoker/JMXInvokerServlet)

       

      snip it from the server.xml

       

      <!-- A HTTP/1.1 Connector on port 8080 -->

       

         <Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}"

                     connectionTimeout="20000" redirectPort="8443" />

      <!-- A AJP 1.3 Connector on port 8009 -->

         <Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}"

               redirectPort="8443" />

        • 1. Re: How do I get HTTP invoker to return an proxy attached to the same port as requested
          mp911de

          Hi,

          add following properties to your connectors:

          proxyName

          If this Connector is being used in a proxy configuration, configure this attribute to specify the server name to be returned for calls to request.getServerName(). See Proxy Supportfor more information.

          proxyPort

          If this Connector is being used in a proxy configuration, configure this attribute to specify the server port to be returned for calls to request.getServerPort(). See Proxy Supportfor more information.

          Best regards,

          Mark

          • 2. Re: How do I get HTTP invoker to return an proxy attached to the same port as requested
            fharms

            Hi Mark

             

            Thanks for the suggestion! Unfortunately I already tried it and it did help in my case.

             

            Then I decide to take a look on the code and from what I can see when the HttpInvokerProxy is created, it always use either the binding address or the hostname from InetAddress.getLocalHost().

             

            But I did find a work around by overriding InvokerURL in the jboss-service in httpha-invoker.sar and the it's the clients job to obtain the HTTP URL to the InvokerServlet. Just before I create a new InitialContext I set the system property with the key from the InvokerURL and then a URL

             

            br

            Flemming