How do I configure Undertow handlers to support proper rewriting for SPA bookmarking?

Viewed 3937

I am trying to configure JBoss EAP 7 (via Undertow) to properly rewrite any SPA URLS back to the SPA's index.html using Undertow handlers. Unfortunately, my API is located at /api, so I need to let any requests pass through which start with /api.

Here is my current configuration (lifted from another SO answer):

not equals(%R, '/my-app') and 
not equals(%R, '/my-app/') and 
not equals(%R, '/my-app/index.html') and 
not path-prefix('/my-app/api') and 
not regex('/my-app/.*\.js') and 
regex('/my-app/.+') -> rewrite('/my-app/index.html')

Unfortunately, this doesn't seem to be rewriting anything. How can I update this configuration to property rewrite URLs?

1 Answers
Related