Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Server rendering with base url #571

Closed
@peter-dangelo

Description

@peter-dangelo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions