Proxying from one app to another

Hi, @robbiehudson. It turns out the behavior is a bug. I’ve gotten an issued filed and the issue is cross-linked to this topic for tracking.

If/when this is known to be resolved, we will post a follow-up here to let you know about it.

The issue works like this:

  • there is a proxy redirect from site-1 to site-2
  • there is a proxy redirect on site-2 to a different path on the same site - site-2
  • the redirect systems checks the source URL path (for site-1) when checking the redirects on site-2
  • because the original source URL path doesn’t match the redirect on site-2 the second proxy rule doesn’t trigger

The only workaround at this time would be to add the same proxy redirect rule to the second site.

Let’s say the site-1 redirect looks like this:

[[redirects]]
  from = "/api/*"
  to = "https://api.example.com/v1/:splat"
  status = 200
  force = true

And that the site-2 redirect looks like this:

[[redirects]]
  from = "/v1/*"
  to = "/.netlify/functions/:splat"
  status = 200

If so, the the workaround would be to add a second rule at site-2 to match the first URL as well like so (this is both rules):

[[redirects]]
  from = "/v1/*"
  to = "/.netlify/functions/:splat"
  status = 200

[[redirects]]
  from = "/api/*"
  to = "/.netlify/functions/:splat"
  status = 200

Again, we will follow-up if the issue itself is known to be resolved and the solution above is only a workaround for the behavior.

If this workaround doesn’t work and/or if there are other questions about this, please let us know.