我正在尝试在 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>