I've got a web application that we am establishing a shopping cart software for that application serves a variety of websites, each with it's own domain. Virtual Hosts are utilized to forward each domain towards the Tomcat 6 server in addition to set the road to that specific websites static assets these static assets can't be saved within the web application, and so are saved around the server and offered through Apache.

first I personally use JkMount on my small context root, then do URL rewrite with [P, L] to take the context path "mywebapp" from the URL, then when someone would go to this application using the domain somedomain.com the net application processes on somedomain.com/mywebapp/store/cart however the browser sees somedomain.com/store/cart. So far this has worked perfectly However , every request is getting it's session totally reset and I'm not sure why.

Basically remove apache in the front-end of serving the Session isn't totally reset and works normally (when i expected). However I can't appear to setup my virtual host to toward the applying without losing periods. I have read a great deal concerning the problem but my competence is within JavaEE, and that i have little understanding of Apache Web Server so I am not really sure where to start researching the fix.

I have heard about something known as ProxyPassing but I am unsure what which means or how it operates most good examples I have seen have changes towards the Tomcat server.xml adding a website, that we can't do because domain names (virtual hosts to complement) get added dynamically and that i can restart Apache, but can not be restarting the JavaEE application whenever a new website is added.

Any suggestions for fixing this, or dealing with the real cause? What other approaches?

UDPATE: I am likely to publish my virtual host entry for among the dynamic websites

    <VirtualHost *:80>
    ServerAdmin test@test.com
    DocumentRoot "C:/wamp/www"
    ServerName jawesome.com
    ServerAlias www.jawesome.com
    ErrorLog "logs/jawesome_com-error.log"
    CustomLog "logs/jawesome_com-access.log" common

    Alias /files/ "C:/static/1/uploaded_files/"
    <Directory "C:/static/1/uploaded_files">
                Options FollowSymLinks Indexes MultiViews
                Order allow,deny
                Allow from all

    JkMount /webapp ajp13
    JkMount /webapp/* ajp13

    RewriteEngine on
    #RewriteLogLevel 9
    #RewriteLog "/usr/local/apache/logs/testrewrite.log"

    RewriteCond %{REQUEST_URI} !^/(webapp/.*|files/.*)$
    RewriteRule ^/(.*)$ /webapp/$1 [P,L]

The Path must be taken off the JSESSIONID cookie. One option is to get rid of it inside your Tomcat setup. Add emptySessionPath="true" for your AJP Connector.

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" emptySessionPath="true"/>

The only real gotcha is for those who have other applications running about this same domain they'd share this session id. However I aren't seeing any inside your config.

I am on the team that's controlling several java webapps each using their own authentication systems. We've several apache servers load balanced and we are using ProxyPass to direct visitors to the after sales webapps. To date, ProxyPass is effective.

Here's a good example which will proxy incoming demands back and forth from 'mywebapp' running on the tomcat server.

<VirtualHost *:80>
ServerName somedomain.com
    ProxyRequests Off
<Proxy *>
    Order deny,allow
        Allow from all

ProxyPass /mywebapp http://tomcat-server:8080/mywebapp
ProxyPassReverse /mywebapp http://tomcat-server:8080/mywebapp
<Location />
    Order allow,deny
    Allow from all
# can put rewrite rules here

We use rewrite rules plus they work fine with proxypass definitions like that one.

Hope this can help, Best of luck.