2 Replies Latest reply on Mar 19, 2013 6:58 PM by Bob Muller

    Need advice on best way to architect a multiple-web-app solution with AS7

    Bob Muller Novice

      I have a scientific web site making the transition to AS7. For the last couple of days I've been struggling with Apache and standalone.xml and jboss-web.xml to get two web applications going on the same AS7 server.


      I want to step back and get advice from the community on the best way to architect the solution rather than trying to "solve" my problems with technical help. Any advice is deeply appreciated.


      The goal is to have a central web application deployed as default-host with root context front-ended with Apache using mod_proxy (no load balancing at this point, a single JBoss instance) and SSL and a straightforward single domain, www.arabidopsis.org. The whole web site must be PCI-compliant (the security standard for processing credit cards). We also have a credit-card processing web app that receives payment information from a third-party credit card processor and stores the information in our order database. I want to deploy that as a separate web application for reasons of security and separation of concerns. We don't really have any specific requirements for the domain for this second app.


      I had thought the simplest way to do this would be to just put the two war files (ROOT.war and payment.war) into the deployments directory and then refer to the second one as www.arabidopsis.org/payment passing through as a straight proxy on root (/), and that's where the configuration nightmares began.


      So, I want to ask the community, what would be the simplest, least-effort way to accomplish our requirements--virtual host with real domain (payment.arabidopsis.org, e.g.), making the payment root context work somehow, some kind of Apache proxying or rule rewriting, or some other solution?


      I'm surprised there isn't more on the forum or the web on multiple-web-application architectures; perhaps I'm not thinking about the problem right?


      Again, I'd appreciate any advice at all on this.

        • 1. Re: Need advice on best way to architect a multiple-web-app solution with AS7
          Bob Muller Novice

          I'm going to work on a virtual host solution for now, as no one seems to have any great ideas about a simpler way.


          1. Create a subdomain payment.arabidopsis.org.
          2. Add an Apache virtual host with SSL
          3. Configure jboss-web.xml with the virtual host
          4. Configure a server in standalone.xml


          I still think this is way more complex than should be required for two simple web apps running under a single server. But apparently not.

          • 2. Re: Need advice on best way to architect a multiple-web-app solution with AS7
            Bob Muller Novice

            Here's my solution to this problem.


            1. Configure the main web app to the root context and don't specify a virtual host in jboss-web.xml:





            2. Configure the second web app to the default context for the web app and specify a virtual host in jboss-web.xml:





            3. Configure two virtual servers in the JBoss standalone.xml configuration file using localhost and the main domain name for the default host server and the exact same JBoss virtual host name for the sub-domain/second web app server:


                   <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host">

                        <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>

                        <connector name="AJP" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>

                        <virtual-server name="default-host" enable-welcome-root="false">

                            <alias name="localhost"/>

                            <alias name="www.arabidopsis.org"/>


                        <virtual-server name="payment.arabidopsis.org" default-web-module="payment"/>

            4. Configure two virtual hosts in httpd.conf or conf.d/vhosts.conf using NameVirtualServers, with one being the www.arabidopsis.org server name and the other being the payment.arabidopsis.org server name, again with the second name being the exact same JBoss virtual host name. Proxy statemens pass through the requests to the localhost:8080 JBoss server, with the proxy statements for the second web app's virtual host looking like this:


            <VirtualHost *:80>

                ServerName payment.arabidopsis.org

                ServerAlias payment.arabidopsis.org


                ProxyPass / ajp://localhost:8009/payment

                ProxyPassReverse / ajp://localhost:8009/payment

            And that's it. Complicated, but it now seems to work once I got all the pieces properly aligned with the same name. When you type "www.arabidopsis.org" you get to the main web app; when you type "payment.arabidopsis.org" you get to the second web app.