How to hide stack traces in a browser (using Jetty)?

I use Jetty as a servlet container. If an exception is thrown in one of my servlets, the browser will display an HTTP ERROR 500 with an exception message and a stack trace.

For security reasons, I need to hide the stack trace. Is there any way to tweak this overall? Or do I need to catch all the Throwables in my servlet?

thanks

+7
stack-trace servlets jetty
source share
1 answer

You can customize the user error page in the web.xml file with the following:

<error-page> <error-code>500</error-code> <location>/WEB-INF/jsps/errors/error.jsp</location> </error-page> 

Then in your error.jsp a custom message will be displayed and don't display stacktrace.

+7
source share

All Articles