【发布时间】:2021-05-12 13:43:39
【问题描述】:
我正在尝试在 azure 上配置静态应用程序,并且正在努力正确路由。当我在应用程序中导航到/lti/login/ 时,它工作正常。但是如果我刷新它会抛出 404,这告诉我我的routes.json 设置不正确(可能)。我希望有人能对此有所了解。
routes.json
{
"routes": [
{
"route": "/",
"serve":"/"
},
{
"route": "/lti/login/*",
"serve":"/lti/login"
}
]
}
App.js
<Router>
<div>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/lti/login/">About</Link>
</li>
</ul>
<hr />
{/* A <Switch> looks through its children <Route>s and
renders the first one that matches the current URL. */}
<Switch>
<Route exact path="/">
<Form />
</Route>
<Route path="/lti/login/*"> <----- If I navigate to this within the app and then refresh it throws a 404.
<About />
</Route>
</Switch>
</div>
</Router>
【问题讨论】:
标签: reactjs azure-static-web-app azure-static-website-routing