Alex Styl
12/06/2021, 12:18 PMStatusPages
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:
install(StatusPages) {
status(HttpStatusCode.NotFound) {
call.respondRedirect("/")
}
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)Kamil Kalisz
12/06/2021, 2:19 PMRequest URL: <http://0.0.0.0/ILoveKotlin>
Request Method: GET
Status Code: 302 Found
Remote Address: 0.0.0.0:80
Referrer Policy: strict-origin-when-cross-origin
Connection: keep-alive
Content-Length: 0
Location: /
Kamil Kalisz
12/06/2021, 2:24 PMAlex Styl
12/06/2021, 3:21 PM