How to use EAP with Single Page Applications that demand internally routed URLs not be 'not found'?

Solution Verified - Updated -


EAP 7.2


Single Page Applications sometimes have 'internal' routers that manage navigation in the browser. As an example, a web application might be served a big HTML file from EAP, then the user might navigate to a URL something like '' where 'heroes' and '42' are handled without leaving the browser. The server doesn't have these resources and can't serve them. (See details at [1])

Problems arise when the user makes use of the 'back' button, cached browser URLs, URLs that are persisted in emails, etc. Without the loaded application in the browser, the requested resource does not exist so EAP will respond with 'not found'. How can this be avoided?



Undertow offers 'rewrite' facilities that can be used to rewrite the incoming request. This can be done at the server or application level, application is probably best. This is accomplished with a file /WEB-INF/undertow-handlers.conf

The exact configuration needed will differ by application. Useful articles describing the necessary configurations can be found at [1] and [2].


This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.