itzg / mc-router

Routes Minecraft client connections to backend servers based upon the requested server address
MIT License
539 stars 35 forks source link

"Unable to find registered backend" #240

Closed beboprocky closed 11 months ago

beboprocky commented 11 months ago

Greetings! I'm trying to figure out how MC-Router works. My current configuration:

My Domain Provider has my "server.com" address pointed at my router. (using "server.com" as a placeholder for my actual domain for this post) I have port 25565 open on my router. This is directed towards my server. My docker compose is using the example one provided, exactly as written:

version: '3.4'

services:
  vanilla:
    image: itzg/minecraft-server
    environment:
      EULA: "TRUE"
  forge:
    image: itzg/minecraft-server
    environment:
      EULA: "TRUE"
      TYPE: FORGE
  router:
    image: ${MC_ROUTER_IMAGE:-itzg/mc-router}
    depends_on:
      - forge
      - vanilla
    environment:
      # enable API
      API_BINDING: ":25564"
    ports:
      - 25565:25565
      # bind the API port to only loopback to avoid external exposure
      - 127.0.0.1:25564:25564
    command: --mapping=vanilla.example.com=vanilla:25565,forge.example.com=forge:25565

When I attempt to connect to the server, I receive the following message in the "mc-router" container logs: time="2023-10-27T13:13:58Z" level=warning msg="Unable to find registered backend" resolvedHost=forge.server.com serverAddress=forge.server.com

The containers for each world seem to be running. The last log message for each server is: [13:17:29] [Server thread/INFO]: RCON running on 0.0.0.0:25575

I have tried without a firewall. I have also tried using NGINX proxy manager to direct both urls "vanilla.server.com" and "forge.server.com" to my MC host machine's 25565 port.

Thank you for any help you can provide. I very much appreciate the work that went into getting the MC server running in Docker.

itzg commented 11 months ago

In the command for the router service, change those "example.com" domains to your "server.com" ones. Mc-router is comparing the hostname in the client sent handshake message against those mappings to determine which backend is being requested by the client.

itzg commented 11 months ago

...if that still isn't working, setting DEBUG env var to "true" can reveal more details about what it is trying to do.

beboprocky commented 11 months ago

That worked. You can mark this as solved/embarrassed. Thanks for the help!