Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Tomcat and the fly likes How to avoid directory listing? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to avoid directory listing?" Watch "How to avoid directory listing?" New topic
Author

How to avoid directory listing?

Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
If the users types in an url for a directory ( like http://www.myDomain.com/myApp/dir/ ) tomcat displays the directory listing.

How can I deny permission for the users to see the directory listing. Is it possible to control it in the server.xml?
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
It is done in the web.xml. Go to conf/web.xml in your tomcat install. Looke for the following code and replace true for false



As shown below

Jason Moors
Ranch Hand

Joined: Dec 04, 2001
Posts: 188
You need to change the Default servlet listing parameter in $CATALINA_HOME/conf/web.xml

Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Thank you. That works :-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to avoid directory listing?