'Netlify redirect rule breaking NextJs
I'm building a NextJs site hosted on Netlify. The idea of the site is that it will be a gradual replacement of another site built on older tech, so the NextJs site will return a page if it has it otherwise the request will be re-written to the older site.
I have a Netlify redirect rule setup in the netlify.toml file as follows:
[[redirects]]
from = "/*"
to = "http://old-site-url/:splat"
status = 200
force = false
For the most part this works. If I add a static file to Netlify, then it is returned, the homepage in NextJs is returned, and pages I haven't yet created get rewriten to the old sites url. However every call to anything in the /_next/ folder return a 500 error.
Remove the redirect and it all works again.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|