JavaXT

How To Disable Directory Browsing in Glassfish

By default, glassfish allows users to get a directory listing if no default web page is present (e.g "index.html", "index.jsp", etc). You can disable Directory Browsing in two simple steps:

      (1) Open <install_dir>/domains/<domain_name>/config/default-web.xml
      (2) Edit servlet/init-param node where param-name="listings". Change the "param-value" to "false". Example:

  <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>