JBOSS web.xml带有 Angular 应用程序的配置文件



我们有简单的 angular 7 应用程序。我用ng build制作了生产构建 - href.一旦构建完成,我们将dist文件夹放在服务器位置。应用程序工作正常,但是当我刷新应用程序时,服务器(JBOSS(无法识别页面的位置。

所以我们修改了jboss服务器中的web.xml来处理 404

<error-code>404</error-code>
<location>/xyz/index.html</location>
</error-page>

但服务器无法识别路径

您必须设置为处理400403状态代码。 因为刷新页面或应用程序时,任何服务器都不知道哪个是根文件。

我们需要在服务器重写规则或配置文件中配置它。

<error-page>
<!-- Missing login -->
<error-code>400</error-code>
<location>/xyz/index.html</location>
</error-page>
<error-page>
<!-- Forbidden directory listing -->
<error-code>403</error-code>
<location>/xyz/index.html</location>
</error-page>
<error-page>

最新更新