所以我有一个部署在 IIS 上的 React 应用程序,我正在使用 React 路由器,我的路由和它们的顺序都很好,一切都在开发模式下本地工作正常,
我的routes.js 文件返回这样的路由:
<Router history={history}>
<Switch>
{/* there are some other routes that are removed from here */}
{/* token is the jwt token for user */}
{!token && <Route path="/Home" component={HomePage} />}
<Route path="/" exact>
{!!token ? <Redirect to="/Dashboard" /> : <Redirect to="/Home" />}
</Route>
<Route path="*" exact component={FourOFour} />
</Switch>
</Router>
Run Code Online (Sandbox Code Playgroud)
我的“未找到页面”有一个 jsx 文件,它返回组件FourOFour,
正如我所说,包括未找到页面在内的所有内容在我的计算机上的开发模式下都显示完全正常。但是当我在 IIS 上部署 React 应用程序时,我的自定义未找到页面不会显示,而是显示 IIS 的默认 404 页面,如何让 ISS 停止扰乱我的路由?
PS:我知道这是服务器的工作来处理 404 等错误,这是默认行为,我也尝试了一些我在网上找到的建议,但其中一些建议毁了一切,有些则不清楚是什么发生,
所以我希望得到 IIS …