Redirecting to a dedicate 404 page is bad SEO practice. There must be a better way to accomplish this.
If I mistyped a URL, and just need to change one letter, now I can't because I've been redirected.
Well, almost inside the server. The server first does TLS processing, then this part, then that which the backend developers see as "the server". From a backend developer's perspective, this code runs in the zone between browser and server, where load balancers and such live. Operationally the code runs on in the same rack, probably on the same CPU, as the backend code.