Felmon no, my extension can't work with multiple domains. As an additional note it can only change paths under the Flarum root, so if Flarum is installed in a subfolder is also means that subfolder will remain part of every request.
Unfortunately this is very complex to achieve so I doubt you will be able to find any example. As I said, the client-side javascript routing library we use for Flarum (Mithril Router) does not support routes on multiple domains, so you would have to modify that code to allow it.
A similar problem affects the server-side routing. In PHP we use Fastroute as the router and it can only work with paths. On the server-side you can "work around" it by using transparent proxy redirects directly at the webserver level like you shared first. It will work for the PHP side, but not for the client-side (javascript).