Assume that I have a webapp running on a Tomcat 6 server with the following directory structure.
/home/
/home/css/
/home/images/
/home/inc/
/home/js/
/home/uploads/
I want to disallow execution of JSP files in /home/uploads/ because there should not be any there. Is there a way to do that in the standard Tomcat 6 config? By “standard” I mean using no 3rd party add-ons or plug-ins, base Tomcat install only.
The best thing to do, IMHO, would be to put the uploads directory outside of the webapp folder.
If you really want to leave it there, you could simply add a servlet filter to your app that is mapped to
/home/uploads, and returns an error in case the URL ends with.jsp.