1
global
        log         127.0.0.1 local2
        chroot      /var/lib/haproxy
        pidfile     /var/run/haproxy.pid
        maxconn     4500
        user        haproxy
        group       haproxy
        daemon
defaults
        mode                    tcp
        log                     global
        retries                 8
        timeout connect 10s
        timeout server 10s
        timeout client 10s

frontend 0
    bind *:25565
        mode tcp
        acl test hdr(host) -i test.mydomain.com
        use_backend 0 if test
backend 0
    mode tcp
        server node0 22.28.29.28:25585 check

Hello,

I'm trying to use haproxy for my Minecraft server. What I want is a config that I can just add more subdomains and what IPs they proxy to. The issue I'm having is when you try to connect it just says "Logging in..." than says "Disconnected". Am I doing anything wrong?

I also have *.mydomain.com pointing to my haproxy server.

Thanks :)

chicks
  • 3,915
  • 10
  • 29
  • 37
someguy9999
  • 11
  • 1
  • 2

2 Answers2

2

Any header-based functionality won't work for minecraft since TCP-mode doesn't look for any headers. Hosting multiple minecraft servers is usually done by using unique ports. The other easy choice is multiple IP's. If you want to go with multiple ports then you would need to create a frontend for each listening port in haproxy.

chicks
  • 3,915
  • 10
  • 29
  • 37
1

Your ACL is never going to match in mode tcp, since you're checking a layer7 functionality.

Change both occurrences of mode to http and you should be good.

GregL
  • 9,870