jorgegorka / svelte-router

Svelte Router adds routing to your Svelte apps. It's designed for Single Page Applications (SPA). Includes localisation, guards and nested layouts.
MIT License
508 stars 42 forks source link

onlyIf guard is not fully working for 404 route #118

Open CatchABus opened 3 years ago

CatchABus commented 3 years ago

In the case of 404, if a user hits /404 on browser, its registered route guard will work (if any).

However, if one is redirected from a non-existent page like /frerdfdfds to /404, then route /404 will ignore its own guard. This is bad on apps with a login page. One usually does not want 404 to show up on login pages because strangers can exploit it to guess route paths that are only accessible through authentication randomly, so guard is very important in such a case.

CatchABus commented 3 years ago

Also, I have worked on a way to make fix this here: https://github.com/DimitrisRK/svelte-router/tree/404-redirect