I do not think I understand `StatusPages` plugin ...
# ktor
I do not think I understand
plugin correctly. I am trying to redirect the user to “/” if they try to navigate to a page that does not exist (say they go to “/invalid”, then the browser should redirect to “/” instead). I was under the impression that I would have to use StatusPages for this like so:
Copy code
install(StatusPages) {
        status(HttpStatusCode.NotFound) {
but when I navigate to “/invalid” the browser displays a blank page and the console shows a 404 for “/invalid”. I set a breakpoint to the call but it is never triggered. Isn’t this what StatusPages are meant to handle? Would I need to use something else for this scenario? (I am thinking that maybe i could use just routing with wildcards)
I just checked your code and it works for me
Copy code
Request URL: <>
Request Method: GET
Status Code: 302 Found
Remote Address:
Referrer Policy: strict-origin-when-cross-origin
Connection: keep-alive
Content-Length: 0
Location: /
Maybe you put in wrong place, like some function that was not invoked during startup
👍 1
Thanks. I’ll check it out 👍