'Redirect Next-Auth get routes in NextJs

How can i redirect from the Next-Auth RestApi get routes such as /api/auth/session

i tried doing a rewrite in next.config but it broke Next-Auth completely

i tried adding a _middeware file in the auth folder but that also broke Next-Auth



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source