3 Replies Latest reply on Nov 17, 2004 1:06 PM by sj_bennett

    Two webapps on different ports in one JBoss

    supermario Newbie

      Hi,

      We have two webapps named customer.war and admin.war
      At the moment both webapps run on Port 80 and is available to the WWW.
      Now, we had a discussion about the security. The conclusion was that we want to move the admin.war to a different Port (e.g. 81). After this action we could administrate the firewall that the Port 81 could only be reached from inside our company, other users from outside (WWW) will be blocked. For information, the firewall can only do such a rule on a port not on a specific url, therefor this port-question.

      So, my question is:
      Can I configure our JBoss, so that consumer.war is deployed to port 80 and the admin.war is only deployed to port 81 (in the same JBoss) ? Which xml I have to change ?

      http://www.domain.com/consumer <- access from WWW
      http://www.domain.com:81/admin <- access only from inside company (due to firewall rule)

      Best Regards,
      Mario

        • 2. Re: Two webapps on different ports in one JBoss
          supermario Newbie

          I saw this site before.
          But I don't want to change the hostname or create viratual hosts with another name.
          I want to deploy my webapps on different ports (one on 80 and other on 81).

          Is this also possible with this "virtual hosts" description ?? Do you mean I have to set up 2 Connectors ?? To be honest, I'm not really familiar with the JBoss configuration.

          Best Regards,
          Mario

          • 3. Re: Two webapps on different ports in one JBoss
            sj_bennett Newbie

            The problem with the solution you're looking at is that the application will still be available on port 80 (use the JMX console and look at the applications listed under the jboss.web heading). I will describe below how I was able to limit access to users inside our firewall using virtual hosts.

            You need to define a virtual host in your server.xml file found in the jboss-tomcat50.sar directory. You can just copy the definition for "localhost", modify the 'name' attribute, and then add an to the host definition. An example for host "foo" is shown below.

            <Host name="foo" autoDeploy="false" deployOnStartup="false" deployXML="false">
             <alias>bar.foo.com</alias>
             <Valve className="org.apache.catalina.valves.AccessLogValve"
             prefix="foo_access_log." suffix=".log"
             pattern="common" directory="${jboss.server.home.dir}/log"
             resolveHosts="false" />
             <DefaultContext cookies="true" crossContext="true" override="true"/>
            </Host>
            

            Next, you need to modify your jboss-web.xml file in the application that you want to run on this virtual host. An example jboss-web.xml is shown below for the "foo" virtual host.

            <jboss-web>
             <context-root>/myfoo</context-root>
             <virtual-host>bar.foo.com</virtual-host>
            </jboss-web>
            

            Finally, you need to add an entry to your DNS server to map bar.foo.com to the IP address of your server.

            If you make these changes, then fire up the JMX console, you should see that the listing for your application under the 'jboss.web' section is shown as //bar.foo.com/myfoo .

            Hope this helps.

            steve