We built the website when a blog post was published
Then we removed the blog post (switched to draft), and Next used the “redirect” part
Then we re-published the blog post, but Next kept redirecting (the blog post worked on local env)
To solve this, we had to re-build the website again
Also, if we add a new blog post, we can see it on the website without rebuilding it.
The question is, is this related to some Netlify limitation (like the On-Demand ISR path revalidation, written in the docs), or is there something wrong in the code?
We had more problems related to this issue,
so we investigated further.
We’ve found that the problem is related to 301/302 cached responses, and what’s worse is that the problem shows up either if there’s a “trailing slash redirect”; if we request a URL like domain.com/slug/ NextJS’s response will be a 301 to domain.com/slug and from now on Netlify will always give a 301 from domain.com/slug/ORdomain.com/slug to domain.com/slug, generating an infinite loop of redirects.
We still can’t find a way to handle this problem; we tried to change the way NextJS handles trailing slash and Netlify’s Pretty URLs feature, but nothing worked.
Is this some “incompatibility” between Netlify and NextJS?
@247X_Dev Thanks for that additional information, that helps! I’ve updated the issue that we have open with engineering with what you’ve found, and we’ll let you know as soon as we have an update from engineering.
Yes, re-deploying our site clears the cache, and the routes work again,
but it’s not a definitive solution because if a user goes to a URL with a trailing slash after the re-deploy then the problem occurs again.
Sorry to hear you are still encountering this. Can you please send us your actual URL so that we can investigate this further? We will need to see this happening in order to re-escalate the issue to the appropriate team.