SvelteKit with StaticAdapter and +error.svelte page

Hi all,
is there a way to display an error page from a SvelteKit frontend application when a route is not found?

In Svelte we can use the +error.svelte page if a route is not found. This works with the local development environment, but not in a local deployment or playground deployment.

Thanks for any help.

To my knowledge, nowadays, only Juno supports global 404, rewrite, and redirection on certified mainnet (documentation).

Thanks for the response.

That means on the IC mainnet all unknown paths will be automatically rewritten to /index.html ?

No, the IC itself does not rewrite or redirect anything. This happens only if such a feature is implemented within the canister.

Yes I think, the dfx assets canister, assuming it’s what you are asking for, redirects to /index.html.

As @peterparker pointed out, this is not currently possible with the Asset canister, but it is supported on Juno. I’m also working on a library that would allow developers to create their own custom-build asset canister and with this you would be able to write any kind of routing logic that your application needs. I’m currently writing documentation for this library before we release it in the next week or so.