Problem: Adding a double slash to the URL causes a crash
Next version: 15.3.2
Example: https://nextjs-platform-starter.netlify.app//revalidation
Error Messages:
Application error: a client-side exception has occurred while loading nextjs-platform-starter.netlify.app (see the browser console for more information).
I’m having a problem with Netlify & Next.js. Adding a double slash at the domain root causes a crash.
Sites hosted on Vercel don’t exhibit this double-slash crash.
This may be a Next.js issue rather than Netlify, however the knock on effect of this is causing a secondary issue with Netlify.
Secondary issue
I have a lot of spam hitting a non-existent, double-slashed path on my site. This spam is using up all of my Serverless Function quota.
I’m trying to set up a 404 redirect to send the spam to a static 404 page. However, I believe this double slash bug is inadvertently causing the homepage of my site to be redirected to the 404 page, as well as the spam path. All other pages, except the homepage, function normally.
Example netlify.toml:
[build]
command = "npm run build"
publish = ".next"
# Send spam to 404 - note the double slashed path
[[redirects]]
from = "//bad/path"
to = "/__404.html"
status = 404
Many of the spam hits are coming from Singapore so I will attempt to block that region but many are also coming from the USA which I don’t want to block.
Is there any other way to block or redirect the double-slashed URLs before they invoke a serverless function?
Potentially relevant issue?: Multiple trailing slashes issue for site root
Given that this has almost completely used up my Serverless Function quota I’d rather not post the URL publicly and get billed $25 for overage charges! Happy to PM the URL to anyone that needs to see it though.