Slok
Slok

Reputation: 626

How can we control error pages in Jetty Websocket with Camel

We are using Apache Camel Jetty Websocket 2.17.1 with jetty 8.

We went through PCI scan and in this we found it is returning 404 pages with resources like

       <html>
         <head>
             <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
             <title>Error 404 Not Found</title>
         </head>
         <body>
             <h2>HTTP ERROR: 404</h2>
             <p>Problem accessing /TOKENIZE.. Reason:

                 <pre>    Not Found</pre>
             </p>
             <hr />
             <i>
                 <small>Powered by Jetty://</small>
             </i>
         </body>
     </html>

I changed this for Jetty Apache Camel component with errorHandler. But not able to change or trace the error page content returned on response with HTTP /GET.

PCI guys tried sending /GET for websocket port and app is returning above 404 content.

FYI. I also set Error Handler in ServletContextHandler.But Still my error handler is not pickedup.

Upvotes: 0

Views: 212

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49462

Jetty 8 (now EOL/End of Life) did not have the ErrorHandler wired up correctly for odd behaviors like HTTP Upgrade only paths (which websocket in jetty 8 is).

Jetty 9.x has overhauled the ErrorHandler to work for all request errors that reach the same context path as the ErrorHandler.

Which means that the only kinds of errors that currently do not go through the ErrorHandler in Jetty 9.x+ are ones that do not reach a context. Such as bad HTTP requests resulting in a 400 status code or proxy requests.

Upvotes: 0

Related Questions