How to route certain paths to another Fly app without a reverse proxy? Meet Fly-Replay

We have an amazing feature called Fly-Replay that let anyone hosting apps on Fly teach our proxy how to reroute requests.

Want to make a request go to another region? No problem. Should this request go to one specific machine? We can do that too. Should this request go to another app entirely? Eeeeasy.

In this demo yall can see how to make an app rerout all requests under /blog* to another app. Don’t even open that link, here’s the entire code block for that:

app.all('/blog*', function replayToBlog(req, res) {
  res.set('Fly-Replay', 'app=fly-replay-blog')
  res.status(204).send('')
})

That’s it. A simple response with a Fly-Replay header. If you’re curious now feel free to open those links below, the readme should teach you a bit more:

Did you know we do that for our Fly Postgres libraries?

6 Likes