How can I get phoenix to get a different node to process a request?

I’m trying to better understand how Plug and Phoenix work together (maybe cowboy would be involved in this too). I’m starting two VMs. One with iex --sname one -S mix phx.server, and another with iex --sname two -S mix. I then connect them with Node.connect :"one@My-Laptop" from the sname two box. Is it possible (maybe via a plug in my Endpoint), to divert a request to the second node? Obviously running the code as I did, I have two nodes connected, but the second one isn’t doing anything. I’m not looking for production ready code, I’m just curious to see how to do something like this, to better understand plug, phoenix, endpoints, and routing.

Thanks!

1 Like