6 Replies Latest reply on Dec 4, 2008 8:01 PM by zeppelinux.dmitry.diligesoft.com

    Seam and mod_proxy

    mgvarley
      Hi all - I am trying to configure my server to get apache to route requests from different domains to different applications on my jboss server and the recommended approach from my host is to use mod_proxy since I am running Apache 2.2.  While this works for the initial request to the home page it does cause me a number of problems with my Seam application.  I have spent some time this afternoon trying to fix this and have uploaded the seam-registration example app to try and investigate the cause of the problem.

      My httpd.conf now looks like this:

      <VirtualHost *:80>
          ServerName mydomain.com
          ServerAlias *.mydomain.com

          ProxyPass / ajp://127.0.0.1:8009/seam-registration/
          ProxyPassReverse / ajp://127.0.0.1:8009/seam-registration/
      </VirtualHost>

      Requests to www.mydomain.com are being correctly routed to the seam-registration application on my jboss server but if I try and submit the form I get the message "The requested resource (/seam-registration/seam-registration/registered.seam) is not available."

      I have done some research on the JBoss forums and have a few people experiencing similar problems but there is no clear solution other than one described here http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4008962#4008962 which I'm not too keen on as it looks like a messy workaround.

      The general advice seems to be to to use mod_jk rather than mod_proxy however the view from my host regarding mod_jk is that "It is not an option on newer setups... you would use mod_proxy instead".

      Any help anyone can give would be very much appreciated.

        • 1. Re: Seam and mod_proxy
          georges.goebel

          Hi,


          Which url do you use ?


          I use the balancer module with our seam applications and it works great.


          f.ex :



          <IfModule mod_proxy_balancer.c>

          <Proxy balancer://myCluster>
                  BalancerMember ajp://myHost1.com:8009 route=worker1 loadfactor=10
                  BalancerMember ajp://myHost2.com:8009 route=worker2 loadfactor=10
          </Proxy>

          <Location /seam-registration>
                  ProxyPass balancer://myCluster/seam-registration stickysession=JSESSIONID
          </Location>

          </IfModule>


          That should work


          Georges

          • 2. Re: Seam and mod_proxy
            georges.goebel

            Sorry my previous post did not use the correct formatting.


            This config works also with 1 node



            <IfModule mod_proxy_balancer.c>
            
            <Proxy balancer://myCluster>
                    BalancerMember ajp://myHost1.com:8009 route=worker1 loadfactor=10
                    BalancerMember ajp://myHost2.com:8009 route=worker2 loadfactor=10
            </Proxy>
            
            
            <Location /seam-registration>
                    ProxyPass balancer://myCluster/seam-registration stickysession=JSESSIONID
            </Location>
            
            </IfModule>
            
            
            


            • 3. Re: Seam and mod_proxy
              joblini

              Hi Mark, Maybe this will help?


              • 4. Re: Seam and mod_proxy
                mgvarley

                Thanks for the advice guys, Ingo - I have been told by host not to use modjk as I am on CentOS running Apache 2.2 and the preferred option is modproxy.  Georges - I have followed your advice and whilst I am able to run the seam-registration app properly my requirements are not quite met.


                Using Georges' config I can run the app as www.mydomain.com/seam-registration but I actually want to be able to run this as www.mydomain.com.


                The reason for this is that I have a number of apps running on my jboss server which I want to run under different domains e.g.


                www.mydomain.com - myhost.com:8009/myapp
                www.myotherdomain.com - myhost.com:8009/myotherapp


                Does anyone have any advice for me on how to get this working?


                Thanks,


                Mark



                • 5. Re: Seam and mod_proxy
                  mgvarley

                  Thanks for the advice guys, Ingo - I have been told by host not to use mod_jk as I am on CentOS running Apache 2.2 and the preferred option is mod_proxy. Georges - I have followed your advice and whilst I am able to run the seam-registration app properly my requirements are not quite met.


                  Using Georges' config I can run the app as www.mydomain.com/seam-registration but I actually want to be able to run this as www.mydomain.com.


                  The reason for this is that I have a number of apps running on my jboss server which I want to run under different domains e.g.



                  • www.mydomain.com - myhost.com:8009/myapp

                  • www.myotherdomain.com - myhost.com:8009/myotherapp



                  Does anyone have any advice for me on how to get this working?


                  Thanks,


                  Mark

                  • 6. Re: Seam and mod_proxy
                    zeppelinux.dmitry.diligesoft.com

                    Is there any real reasons for you to use ajp://127.0.0.1:8009/context
                    instead of http://127.0.0.1:8009/context ?