Reducing information disclosure in Tomcat error pages

前端 未结 5 1384
灰色年华
灰色年华 2021-02-05 15:20

By default, Tomcat\'s error pages disclose both the existence of Tomcat and the exact version of the container that\'s handling the requests. This is nice for development, but

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-05 15:50

    Some of the errors are sent directly by the container and your application doesn't have a chance to deal with them. For example, when a non-existent resource is requested, the 404 error will be sent. The only way your application can do something about it is to declare the appropriate entry in the web.xml.

    I agree with Jeremy Stein that the is the right answer. After all the error codes aren't unlimited.

    Read also the discussion here, about how errors are handled with Spring MVC. I believe that it is most important is to handle your own errors (the exceptions that if they don't get caught will result in a 500 Internal Server Error).

提交回复
热议问题