Forwarding TCP and UDP streams based on hostname

hello All,
glad i found this community .. hoping someone can help me .
I have an app that runs on a couple of ports ...on one port1 it sends udp and tcp traffic to the docker instance .. and on 2nd port it sends TCP only . I have struggled for 10+ hours and finally gave up today and decided to search around.

Can anyone help me figure out ?

Docker:
App
Server1
TCP : 20001
Server2:
TCP 20010
UDP 20011

Client needs to connect to domain/url server1.domain.com and server2.domain.com ( can be set up as server.domain.com if that makes it any better )

Traefik needs to look at incoming hostname , send tcp/20001 to server1 and send tcp/20010 and udp/20011 to server2 .

I was able to get a lot of it working .. ( or atleast i think , docker instances were able to run , connect on udp etc , even got ssl from zerossl , letsencypt didnt work for some reason ) but my client could not connect ..couldnt even see the incoming connection in logs.

Any ideas /sample to try ?

cheers

Ok decided to try it one more time .. I can get the client to work if i specify the port number with server which i could do even without traefik
so now the only thing is getting traefik to recognize the hostname incoming and decide the port.

cheers

UDP does not have a host name in the protocol, so you need a different port for each service.

HTTP includes the host in the headers and TCP (and HTTP) include the host in the TLS protocol (if used).

i get that but i am hoping traefik knows anything coming to hostxyz is destined for if tcp port a or if udp port b .. or am i banging my head against a wall
also client sends data as http stream
i think

This is not possible. If you want plain proxy/forward based on ports, you can do that.

Create entrypoints on 20001, 20010, 20011, open ports in Docker. Make sure to set UDP if required.

Create dynamic config file with 3 routers, each listening on one entrypoint, use rule HostSNI(`*`) for TCP, create 3 services to forward. Load dynamic config file with providers.file in static config.

Read docs about entrypoint, routers, services, especially for UDP. Check simple Traefik external example.