I am using Sitecore 9.3 JSS with a Create React App front-end with a virtual folder setup.
When I create a link pointing to the site root item, it works fine when directly browsing to it e.g. opening http://localhost/virtualfolder/roothttp://localhost/virtualfolder/root
.
But when I use client-side navigation (with React router under the hood) the page (/root) cannot be found.
This is due to Layoutservice HTTP call that does not return any route
data for: http://localhost/sitecore/api/layout/render/jss?item=%2Froot&sc_apikey=&sc_site=my-apphttp://localhost/sitecore/api/layout/render/jss?item=%2Froot&sc_apikey=<key>&sc_site=my-app
When I manually change this to http://localhost/sitecore/api/layout/render/jss?item=/&sc_apikey=&sc_site=my-apphttp://localhost/sitecore/api/layout/render/jss?item=/&sc_apikey=<key>&sc_site=my-app
it returns route
data.
Any clues on how to fix this?