Disabling directory listing in tomcat

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.

Labels

 
(None)