One of the developers here has been hunting for a solution to the following configuration issue:In tomcat, a SESSION’s cookie path is automatically generated by Tomcat and set to the application’s context path (e.g., the name of the .war file). This creates somewhat of an issue as it forces all URLs of the application to live underneath this folder. The issue is that the application is now getting URLs that are three, four, and even five levels deep. Long URLs are generally bad for SEO (search engine optimization), so it would be great if we could eliminate the application context’s urls and have several root folder aliases that point to the same application.This can easily be done with Apache’s mod-rewrite, but the SESSION cookie path is the lingering issue. If the application name is ‘foo’, then the session cookie’s path will be set to ‘/foo’. If I create new urls that live in a different root folder, say ‘/bah’ and use Apache re-write to translate them to ‘/foo’, then the mapping works and the correct pages fire, but the SESSION cookie won’t be included in the browser’s request since it lives in the ‘/foo’ path.
Ideally, I should be able to set the SESSION cookie’s path to the root folder ‘/’. This would not create an issue for us since we only have one other application running, the default one, that handles static objects. Ideally, I’d rather not use our application as the default.
So if anyone has a solution to this issue, feel free to comment!
Thanks!
Leave a Reply