Server rendering with base url #571
Description
hello - my app is based off the aspnetcore_spa yeoman generator (react with redux variety). i need to host this app under a base url, and am having an issue when reloading a deep link page. in my boot-client file i have this:
const browserHistory = useRouterHistory(createHistory)({
basename: '/myapp'
});
const history = syncHistoryWithStore(browserHistory, store);
and my routes file:
<Route path='/myapp' component={Layout} >
<Route path="/" components={{body:AccountsPage}} />
<Route path="/account" components={{body:ManageAccountPage}} />
</Route>
app works fine until i refresh from the /myapp/account url. this results in an error thrown from the boot-server file on this line:
if (!renderProps) {
throw new Error(`The location '${ params.url }' doesn't match any route configured in react-router.`);
}
// output: The location '/myapp/account' doesn't match any route configured in react-router.
i'm not sure if this is a react-router issue? the odd thing is if i comment out that throw, everything seems to be working fine. if i hit a non-existent route, e.g. /myapp/bad, then react-router issues a warning that the location did not match any routes, and an empty page is returned. not a great UX. but having deep link refreshes is a must-have.
any help or advice would be greatly appreciated!
thanks