Accessing fly.io reverse proxy (/blog)

Hey folks!

I’m trying to solve a problem that I believe would be relatively straight forward if I was hosting my own reverse proxy, so hopefully there is a simple solution.

I’m running a Phoenix app in basically the standard / out-of-the-box way with the Dockerfile and toml provided by Fly.

My goal is to have a subpath (/blog) map over to a completely different (Wordpress hosted) website, in such a way that the user appears to be interacting with a single domain.

I believe the best solution would be some sort of proxy/rewrite at the Fly level. I’m also not above creating something in Phoenix itself for reverse proxying as I don’t believe this will be high traffic.

Any pointers on where to begin?

2 Likes

Funny enough I have an example just for that!

Gotcha. Honestly - I saw this but the term “replay” was throwing me off. I understand what you mean after reading more.

Am I correct in understanding that you can only replay requests over to another Fly instance though? My use case is to send traffic over to a separately hosted blog.

Understood. Fly replay works on our proxy and it’s only able to serve requests to intended here indeed.

For an externally hosted blog you could either just reverse proxy directly in your main app or use fly replay to a proxy app.

I ended up skipping the host proxy entirely and just solving the problem with Phoenix.

Here’s a little write-up on how I did it:

2 Likes