Client Side Deep Links with WebpackDevMiddleware 404s

女生的网名这么多〃 提交于 2019-12-05 01:26:20

I was able to get around this using the status code pages middleware to handle all status codes and re-execute using the root path. This will cause the spa app to be served up for all status codes in the 400-599 range which is not quite what I want but gets me working again at least.

//setup spa routing for both dev and prod
if (env.IsDevelopment())
{
  //force client side deep links to render the spa on 404s
  app.UseStatusCodePagesWithReExecute("/");
  app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
    HotModuleReplacement = true,
     ProjectPath = Path.Combine(env.ContentRootPath, Configuration["ClientProjectPath"]),
     ConfigFile = Path.Combine(env.ContentRootPath, Configuration["ClientProjectConfigPath"])
  });
}

Hopefully, this will help someone in the future that might be bumping up against this issue.

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