Tomcat : Disabling directory listing in tomcat

This page last changed on Oct 03, 2008 by Kees de Kooter

By default directory listing is enabled in Tomcat 5. This is fine for development purposes but not desirable in production deployments.

To disable this for the entire tomcat server go to $CATALINA_HOME/conf/web.xml and set the listings parameter to false.

<servlet>
        <servlet-name>default</servlet-name>
                <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
            <init-param>
                <param-name>debug</param-name>
                <param-value>0</param-value>
            </init-param>
            <init-param>
                <param-name>listings</param-name>
                <param-value>false</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
    </servlet>
</sect1>

In Tomcat 6 the default value is false.