lazymc icon indicating copy to clipboard operation
lazymc copied to clipboard

Reverse proxy to multiple minecraft servers based on domain

Open timvisee opened this issue 2 years ago • 2 comments

Discussed in https://github.com/timvisee/lazymc/discussions/35

Originally posted by tW4r December 21, 2022 This project already does proxying internet:25565 -> lazymc:25565 -> minecraft server:25566

It is possible to determine the domain the user is connecting to from the login packet Based on this fact it is possible to direct them to different minecraft servers as such

server-a.example.com:25565 \                  / minecraft server-a:25566
                           +-> lazymc:25565 ->+
server-b.example.com:25565 /                  \ minecraft server-b:25567

An example of this is infrared (https://github.com/haveachin/infrared)

I would imagine it could work by splitting lazymc.toml to multiple files in a config directory:

# file 1
[public]
address="server-a.example.com"
[server]
address="127.0.0.1:22566"
# file 2
[public]
address="server-b.example.com"
[server]
address="127.0.0.1:22567"
```</div>

timvisee avatar Jan 12 '23 18:01 timvisee

I've added a draft PR #42 for this, if you have some time it'd be great if you could tell me if I'm going the right direction

tW4r avatar Feb 09 '23 15:02 tW4r

If you use docker, I have created a solution to this problem: https://github.com/joesturge/lazymc-docker-proxy?tab=readme-ov-file#multiple-server-support

joesturge avatar Aug 05 '24 23:08 joesturge