Rewrite to another nextjs netlify site

  • Site 1: https://development--splunk-show.netlify.app/
  • Site 2: https://development--show-admin.netlify.app/.

Hi there, I have two nextjs apps deployed on Netlify. I’ve added a rewrite rule on the site 1:

[[redirects]]
   from    = "/admin/*"
   to      = "https://development--show-admin.netlify.app/:splat"
   status  = 200
   force   = true

The rule is working, whenever I navigate to the /admin path the site 2 document is fetched, but, the statics files that site 2 requires are being searched to the site 1, returning 404 errors:

It sounds like a common issue, but I didn’t find any post about it or any nextjs/netlify documentation. Is there any way to solve this at the redirect/rewrite level of netlify?

Any help is appreciated, thanks!

Try using the base tag: HTML base tag on the to site.

Thanks for your answer, the base tag fixed the 404 error, but it generates another issue:

The site doesn’t perform any replace call on the history, I guess is something happening behind nextjs router API.
Any thoughts to solve this?

Hey there, @mrcportillo :wave:

Thanks so much for your patience here. Would you be able to provide login credentials for us? We cannot continue debugging without being able to access your site further.

Let me know!