UrlRouter refresh page gives 404

I want to use UrlRouter and not HashRouter

When I browse to http://localhost:8080/ it redirects me correctly to http://localhost:8080/exams (I changed the name of “top”)

However, if I browse directly to http://localhost:8080/exams or refresh the browser I get a 404. Can’t figure it out.

Straight forward app config…

const defaults = {
id : “MyApp”,
version : VERSION,
router : BUILD_AS_MODULE ? EmptyRouter : UrlRouter,
debug : !PRODUCTION,
start : “/exams”, || “”,
views:{
“stage” : “stages.stage-details-container”,
“item” : “item.item-details-container”,
“settings” : “settings”,
“team” : “team.team-summary”
}
};

@Splay
you need to configure server side properly.
when you browse directly to /exams, server looks for physical location or what it is configured for and cannot find it.
try to configure server so that response for inexistent locations was your main location.

Thanks @intregal

Do I do that in the webpack congfig?

I tried

devServer:{
stats:“errors-only”,
historyApiFallback:{
index : “index.html”
}
}

most probably yes.
I do not use devserver, but historyApiFallback should be the right way.

Seem to have got it with a combination of

index.html…

if(document.location.pathname == “/index.html”)
document.location.href = “/exams”;

webpack…

devServer:{
stats:“errors-only”,
historyApiFallback:{
index : “index.html”
}
}