Netlify’s site name is sinom-app.netlify.app
I need redirects with a changed origin for my development, staging and production environments. So if the env is:
- staging or localhost FE it should redirect to → staging API
- prod builds it should redirect to → prod API
FE builds on netlify. We have a staging.app.url for the staging branch and an app.url for the master.
The backend is built on digital Ocean.
We have auth done with cookies so we need to have redirects from FE to BE. Currently, we are using CRA with proxy set in package.json for local dev. Unfortunately, I’m not sure how to set up different redirects on Netlify for other builds. Currently, we have a file In the public folder that redirects all /api
requests to the backend URL. But how can I set it up so it redirects to the staging API on staging branch builds and to the prod API on master builds?