Support Forums

2 repos 1 domain - proxying not working


I’ve got 2 web apps for the same client (migration project). The first app is a legacy Angular app. The other is Next.js.

There are a set of routes ready to go live in the new app, under /music. I want to redirect some /music routes from the legacy app, to the new app.

This is my current _redirects file:

/music/album/4 https://fr-react.netlify.app/music/Album-Title
/* /index.html 200

This works - it redirects, but I want to proxy these routes and cannot seem to get this working. E.g I want new-app.com routes to appear as if it’s on the same domain as legacysite.com. So if you go to here:


It will render the new app, but keep the root domain:


is this possible? Am I being an idiot? I have read lots of help posts and READMEs and cannot get it working. I’ve tried splats, adding 200 to the redirects, but it doesn’t work. Help please? :slight_smile:

Legacy site: https://fionaross.co.uk
New site: https://fr-react.netlify.app/music/Black-White-and-a-Little-Bit-of-Grey

Hi @ttbarnes,

That’s supposed to work, but it won’t in the following condition:

If your destination page is not static, that is it’s being rendered on the fly by Netlify using Netlify Functions, this would return a 404. This is because, Netlify doesn’t proxy twice. You request the /music/album/4 page, it proxies to the new website. That’s good. But if that destination page needs to proxy again to a Netlify Function to render itself, it won’t work! Netlify will not proxy the URL a second time.

So if that’s what’s happening in your case, your solution is to either disable server side rendering for those pages and make them fully static, or not try to proxy to that page (use plain redirects).

Thank you @hrishikesh,

I’m not using any Netlify Functions apart from any that come from Next.js out of the box

The destination page (Next.js) is server side rendered. The legacy site that redirects to the new site, is static/rendered client side.

I’m using plain redirects at the moment and working great. I thought it would be proxying, but it doesn’t seem to be doing that.

Is it possible to serve some Next.js pages, with the original domain?

As I said, as long as pages in the Next.js website are static, proxying would work. So you need to decide between proxy or server side rendering. The only other way to get them to work on the Angular website would be to use iframe.

Sorry I understand now :slight_smile: Thank you!

I don’t think that serving the Next.js app as static will work for social media/meta tags.

Iframe feels dirty but great idea, I’ll have a look into this.

Will be great to have something in place to do gradual migration to Next.js

Thanks so much for your help