2017-04-09 81 views
0

我的角2应用程序在我的本地节点服务器上运行良好。然而,当dist/prod内容被部署到服务器(确切地说是websphere liberty服务器)时,url只能正常工作。当我尝试重新加载它时,它会给我发现文件未找到异常。例如http://localhost:5555/myapp/route1/somefeature/extra的深度路由也不起作用,并引发相同的异常。Angular 2路由配置在自由Websphere服务器

只是为了确认:

  1. 我使用正确的basehref(对于如 '/ myProduct的/')
  2. 的server.xml中包含适当的contextPath( '/ myProduct的/')
  3. 因此,网址http://someserver:8080/myproduct/myapp运行正常,但刷新或深航被击中时,它抛出文件未发现异常

我已经通过这篇文章Angular2 routing/deep linking not working with Apache 404消失,需要类似那种SETT的因为我不想回头去包含旧的哈希(#)URL的实现,在这方面的任何帮助,我们都非常感谢。

+0

我们移动到表达服务器来服务我的应用程序。即使在快递中,我们也必须编写这一特殊行来将所有请求重定向到index.html。 (app.use(express.static(path.join(__ dirname,'prod'))); app.get('/ *',function(req,res){ res.sendFile(path.join(__ dirname,'prod')+'/index.html'); });' – Rajeev

回答

0

你在web.xml中试过吗?

<error-page> 
    <error-code>404</error-code> 
    <location>/</location> 
</error-page> 
+0

thanks for输入。然而,只是一个更新..我移动表示服务器:) – Rajeev

相关问题