Proxy to another Netlify site

Hi,

I’m having trouble getting a proxy to another site working using a _redirects file.

I’ve had this working on our production site (proof2-marketing.netlify.app) for a few months, all requests to /projects/* are served from proof2-projects.netlify.app

We’ve had a staging version of the projects site hosted at projects.staging.proofplatform.io (proof2-projects-staging.netlify.app) for a while, but I’ve only just setup a staging copy of the marketing site at staging.proofplatform.io (proof2-marketing-staging.netlify.app). So now I’m trying to setup the same /projects/* proxy to the staging projects site (proof2-projects-staging.netlify.app) but it’s not working properly. The top-level Discover New Crypto Tokens on PROOF page comes back with a browser error page saying “The page isn’t redirecting properly”, but any page under /projects (e.g. /projects/some-page) will load correctly from the staging projects site.

Is there a good reason I’m overlooking why this isn’t working on the new staging site setup, but it is working on the production site (thankfully!)?

Cheers

Hi @proof-platform :wave:t6:

To set up a proxy from one Netlify site to another, you can use the _redirects file. The rule should look something like this:

/projects/*  https://proof2-projects.netlify.app/:splat  200

This rule will redirect all requests from proof2-marketing.netlify.app/projects/* to proof2-projects.netlify.app/*. The :splat wildcard is used to capture all the URL segments after /projects/ and pass them to the target site.

Make sure the _redirects file is located in the publish directory of your site. If you’re using a site generator, you may need to configure it to include the _redirects file in the output. For example, with Jekyll, you would need to add an include parameter to _config.yml to avoid exclusion of files that begin with _ (source).

If you’re still having trouble, it might be helpful to check the Netlify documentation on redirects and rewrites and proxies. If you’re seeing errors, you might find some clues in the Netlify Support Forums

Hey @SamO :wave:

Thanks for taking the time to reply! We already have redirects setup using a _redirects file similar to your example. It works as expected on our production site, everything under /projects (including /projects itself) is being served by another Netlify site:

The problem is that when trying to copy this setup for our new staging site (at staging.proofplatform.io), the /projects page is hitting a redirect loop (error: ERR_TOO_MANY_REDIRECTS), but the _redirects config seems to be correct because any pages under /projects do work:

Hi @proof-platform,

This is being handled in the helpdesk.

1 Like