Next.js server crashes (ERR_INVALID_URL) on requests with invalid url, like *
.
Is there a way to prevent this? For instance, intercepting the error and wrapping it into the try
block.
Solutions like the custom error page (pages/_error.ts
) seems to not work.
Asked
Active
Viewed 1,104 times
0

hopeless-programmer
- 787
- 5
- 17
-
1Pleas provide your code . – MarioG8 Nov 27 '21 at 14:48
-
I don't think there is a code I can provide. The crash reproduce on a blank next.js project with a simple http request like `request({ hostname : "localhost", port : 3000, path : "*" })`. – hopeless-programmer Nov 29 '21 at 10:59
-
do you perhaps have an update? – Les Feb 10 '22 at 12:28
-
Yes. This was a bug in next.js and a potential vulnerability. I have created an issue on github and this was fixed on the next release. – hopeless-programmer Feb 10 '22 at 18:50