-1

I have multiple docker applications (Minecraft servers, web servers, databases, unify webkey, etc.) running on a Linux machine. Let's call this machine example.com. Any call to example.com will be picket up by the Linux machine. Is there a way to redirect its subdomains to the different docker instances running on it, so for example mincraft1.example.com goo's to the Minecraft docker1 and unify.example.com goo's to the unify docker. This without mapping the ports on the localhost of the Linux machine.

I managed this for HTTP requests with nginx but there you have to specify every port you want to use. I would like to redirect all the ports and protocols at once. Technically mapping the IP of the docker to the subdomain.

Is this possible and how can I do this?

K.Mooijman
  • 11
  • 4
  • see also: https://serverfault.com/questions/878080/how-do-i-make-protocol-foo-hostname-aware – A.B May 09 '21 at 14:32

1 Answers1

2

I managed this for HTTP requests with nginx but there you have to specify every port you want to use. I would like to redirect all the ports and protocols at once. Technically mapping the IP of the docker to the subdomain.

HTTP(S) includes a host name in the header, to explicitly allow virtual hosting of this kind.

Other protocols, however, don't.

NAT and port forwarding happens on TCP/IP or UDP packets, which does not contain any information about domains. The domain name is resolved by the client system, which then will use the IP it resolves to in the packets to address them.

So no, you can't do what you want to do, unless your protocol supports a hostname field, or you have multiple IP's - one per subdomain.

vidarlo
  • 3,775
  • 1
  • 12
  • 25