Asset Canisters - URL Rewrite to index.html

Hello,

When using React Router child routes, a child route/URL can not be rendered when the browser is refreshed, or the link is opened directly. This can be fixed if the web server rewrites the URL to index.html: Fixing the 'cannot GET /URL' error on refresh with React Router (or how client side routers work).

I understand that asset canisters only serve static content, but is possible for the IC to provide configuration for URL rewrites?

Thanks.

Hello :slight_smile:
I did not have such a problem and routing works both locally and in production.
I am using [email protected] and Router with passed history object.
Can you provide more details?

Thank you @3cL1p5e7. I discovered that the URLs were incorrect due to an environment setting during build.

I am now able to refresh child routes and open them directly in the browser. So, it appears that the IC is actually handling the URL rewrite for us, which is great!

1 Like