HAProxy community

Use HA-Proxy with SRV Resolver & server-template for non-http (mode tcp)?

#1

Hello,
I’m trying to figure out how to use HA-Proxy behind Cloudflare using SRV-Record (Minecraft-Server) and HA-Proxy to forward the IP/Port given by SRV-Record hint to internal IP (VM System). This is the first time I try to figure out how SRV-Record/Resolver works.

Does a resolver make sense in HA-Proxy using “server-template” to make HA-Proxy try to resolve the IP/Port configuration in this case (mode TCP) or is this useful for HTTP(s) Balancing only?

Will the SRV record need to point to HA-Proxy IP (given by Target & Port) or to the internal IP-Adress that HA-Proxy should resolve to internally to forward it into the private VM-Network? If so, will the native A-Record point to HA-Proxy then?

Example:
_minecraft.node01.foobar.com <-- SRV Record pointing to target 172.16.2.100, port 25565
node01.foobar.com <-- HA-Proxy IP

or will I have to create a normal frontend for each VM-Node and TCP-Port the usual way to forward each port to internal VM-IP/Port and use SRV only as hint for the TCP-Port to be used by Minecraft Game-Clients?

0 Likes

#2

DNS resolution is not limited to HTTP, it should just fine for TCP also.

The records haproxy is resolving are those of the backend servers, not haproxy itself. It can be either SRV o A, both works.

The actually A record you give out to your customers should only point to haproxy then, yes.

Note that the whole DNS resolution thing in haproxy only makes sense if you need to change backend IP addresses very often, and cannot reload haproxy for it. If that’s not the case, it’s way easier to just configure the actual backend IP addresses in the configuration, and when you need to update it, you just update the configuration and reload haproxy.

0 Likes