刷新Wildfly中的angular应用程序时出现错误403

刷新Wildfly中的angular应用程序时出现错误403,angular,wildfly,war,http-status-code-403,Angular,Wildfly,War,Http Status Code 403,我已经使用哈希定位策略实现了angular 6应用程序,并希望在Wildfly中将其部署为WAR。应用程序运行正常,但是重新加载页面(例如)会导致403禁止的错误。以下是设置: WAR文件: web.xml MyApp app/index.html 403 /error403.html 感谢您的帮助。可能与之相关的人: 403错误是由于基于哈希的定位策略而发生的。URI中以#开头的所有内容在发送到客户端之前都会被删除。在我的示例中,URL以/app/结尾,它被undertow识别为目录。由于

我已经使用哈希定位策略实现了angular 6应用程序,并希望在Wildfly中将其部署为WAR。应用程序运行正常,但是重新加载页面(例如)会导致403禁止的错误。以下是设置:

WAR文件: web.xml

MyApp
app/index.html
403
/error403.html
感谢您的帮助。

可能与之相关的人:
403错误是由于基于哈希的定位策略而发生的。URI中以#开头的所有内容在发送到客户端之前都会被删除。在我的示例中,URL以
/app/
结尾,它被undertow识别为目录。由于默认情况下不允许目录列表,因此返回403。的解决方案是实现一个WebFilter,它检测此请求并重定向到角度页面
/app/index.html

您可以发布您的web筛选器实现吗。
/app/* -> angular app generated by ng-cli
/error403.html -> simple error page
/WEB-INF
/WEB-INF/web.xml
/WEB-INF/classes/... REST services
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    <display-name>MyApp</display-name>

    <welcome-file-list>
        <welcome-file>app/index.html</welcome-file>
    </welcome-file-list>


    <error-page>
        <error-code>403</error-code>
        <location>/error403.html</location>
    </error-page>
</web-app>