Forward to nested Caddy instance if not defined

By “defined in the VPS” I mean any domain listed explicitly in the VPS’ Caddyfile. For example, given the Caddyfile above, “defined” domains/URLs would be rapi.ga and www.rapi.ga (:443 and :80). Anything that’s different than that, would be forwarded to the RPI (that’s what I’m trying to do by creating rules for :80 and :443 alone).

But, like you said, this sounds more like a networking/architecting issue than something Caddy would solve (I’m gonna need something like Nginx’s stream {} blocks or your L4 module in order to forward raw TCP sockets, and the setup might be a lot more complex and far away from the purpose of any HTTP server).

For now I’ll try to keep working this out and see if I can come up with something, even if it isn’t a good idea (read somewhere that one of Caddy’s goal is to be clear/explicit about what’s going on in its configuration).
In case I get to achieve something, will be posting here. Gonna mark @francislavoie answer for now because his provided info oriented me a little more. Thanks, really!

P.S.: I don’t think you guys are “random Internet users”, because you created and maintain Caddy, which by the way I admire a lot, thank you for all of your hard work.