Define root path per router instead on endpoint level only

I don’t know how to get rid of the routing issue for your solution. For this specific problem I think having separate endpoints with a master proxy is an acceptable solution. One can define an endpoint that proxies the others based on whatever logic you want. Domain. Route. Whatever. See this example.

https://github.com/wojtekmach/acme_bank/blob/master/apps/master_proxy/lib/master_proxy/plug.ex