I am using Jetty to deploy a production website. Let’s assume my website is foo.com When I point my browser to a context which does not exist (say foo.com/notavailable), Jetty shows an error page with information of all the contexts which are deployed on it.
It looks something like this:
No context on this server matched or handled this request.
Contexts known to this server are:
- /test —> org.mortbay.jetty.webapp.WebAppContext@6910fe28{/test,/root/webserver/jetty-6.1.4/webapps/test}
I want to prevent Jetty from showing this message because it contains the full path to the context on the server.
Is there a way to do this?
That page is provided by the Jetty “DefaultHandler”
To stop that page from displaying, you should remove that handler from your server (it’s configured in your jetty.xml file)
You don’t really need (or want) the default handler on a production (internet facing) server, so it’s a good idea to remove it.
Note, that it also provides the regular 404 page, and the favicon.ico so if you’re relying on those behaviours then you’ll need to put in a replacement.