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

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 04:52:01

As a start, try this configuration in WEB-INF/undertow-handlers.conf:

path-prefix('/api') -> done
path-suffix('.js') -> done
path-prefix('/') -> rewrite('/')

You shouldn't need the /my-app prefix on any rules as they are already running in the context of your app.

However, you may need to add other predicates to prevent rewriting other resources like stylesheets, favicons, sourcemaps, etc. The full list of predicates and handlers can be helpful to produce more specific, targeted rules.

Please note, path-suffix still accounts for a path like /app?thing.js. Though you may never use a query parameter like that, it's good to keep in mind that it'll be rewritten.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!