I’m attempting to replace a particular path of a React app with a redirect to yet another React app. To keep the UX consistent it would be ideal to use a 200-status redirect instead of a 301 so the URL doesn’t show any difference to the user.
I’ve set a redirect rule in the _redirect file like so:
[[redirects]]
from = "/pals/join"
to = "https://deploy-preview-2--pal-signup-web.netlify.app/pals/signup"
status = 200
force = true
The redirect executes, but the request doesn’t resolve correctly. I end up with a blank screen and a console message that states:
Refused to execute script from 'https://deploy-preview-505--staging-joinpapa-dotcom.netlify.app/static/js/main.0bbcb0c2.chunk.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
I don’t see this main.xxx.chunk.js
in the browser sources, and it looks like it’s trying to pull the file from the wrong domain anyway.
Is there a way to provide enough configuration to make the destination React app load up correctly?
Is there also a way to make react-router handle subsequent renders successfully? The new/destination app is an SPA, so any renders triggered after initial load of the destination site just need to go back to that same index.html, I believe.
Original site:
https://deploy-preview-505--staging-joinpapa-dotcom.netlify.app/pals/join
Redirecting to:
https://deploy-preview-2--pal-signup-web.netlify.app/pals/signup