Tomcat 7 trailing slash issue with webapps

Recently I upgraded my tomcat server from 6.x version to the most recent 7.x version.

I came up with little trouble, hoping to get help.

I have an application calls MyApp

On tomcat6, when I went to http://www.example.com/MyApp/page/ I normally would get the wanted result.

Now, on tomcat7, visiting the same exact url (with the trailing slash) I'm getting the error: "Resource is not avaliable", as the tomcat thinks that /MyApp/page/ is a whole webapp name instead of being request names page under the MyApp webapp.

I need the slash at the end on my url because otherwise I'm getting the error: "HTTP Status 405 - Request method 'GET' not supported" which is OK because I really did not permit the GET method to the "page" request.

If someone knows how to tell tomcat that trailing slash after path of existing webapp should not suppose to redirect it to new webapp calls the whole "string" and just process the request like on tomcat6, it would be great!


Ancient question, but since I have recently battled with the terminating slash in Tomcat 8, I know that problems with the slash continues to plague the Tomcat user world. :-)

What you might be running into is changes in the way that Tomcat handles redirects when loading the root context. Check out bug 58660 and read some of the developer discussion there. You may need to turn off the default mapper by modifying the mapperContextRootRedirectEnabled attribute of the Context element in conf/context.xml.