If you want to forward requests to dedicated servers, you need to create a dedicated router+service for every one. In a dynamic config, loaded via provider.file
for example.
Just conceptually, not real config;
routers:
uuid1:
rule: Host(`example.com`) && PathPrefix (`/uuid1`)
service: uuid1
uuid2:
rule: Host(`example.com`) && PathPrefix (`/uuid2`)
service: uuid2
services:
uuid1:
loadbalancer.server.url: http://1.2.3.4
uuid2:
loadbalancer.server.url: http://1.2.3.5
If you don’t want the path prefix in the target request, you can use middleware stripprefix
to remove it.
Note that regular web-apps are not easily running behind path prefix. They are usually not path aware and may send redirects and links without the prefix, breaking functionality. Use sub-domains instead. It usually works for pure API request.