Setting up a Minecraft Bedrock Server can be exciting, and making it accessible over the internet for friends to join is a common goal. If you’re already using Traefik as a reverse proxy for your web applications, you might be wondering how to extend its benefits to your Minecraft Bedrock server. This guide addresses the challenge of exposing a Minecraft Bedrock server using Traefik, focusing on the necessary configurations for UDP traffic.
The original poster, a new Traefik user, encountered difficulties while trying to proxy their Minecraft Bedrock server. They successfully used Traefik for web-based applications like Emby and Nextcloud, but faced issues when applying it to a Minecraft Bedrock server, which primarily uses UDP.
The core problem lies in understanding how Traefik handles UDP traffic, which is connectionless, unlike TCP used by web applications. Minecraft Bedrock servers default to UDP port 19132. The user’s initial Traefik configuration included both TCP and UDP entry points on port 19132, but they were still facing issues connecting from outside their local network using a web address.
Let’s break down the necessary steps to correctly configure Traefik to proxy a Minecraft Bedrock server.
Traefik Configuration for UDP
For Minecraft Bedrock, you need to configure Traefik to handle UDP traffic specifically. The entryPoints
section in your traefik.yml
should correctly define a UDP entry point:
entryPoints:
http:
address: ":80"
https:
address: ":443"
udpminecraft:
address: ":19132/udp"
This configuration defines an entry point named udpminecraft
that listens for UDP traffic on port 19132. It’s crucial to specify /udp
to indicate that this entry point is for UDP.
Docker Compose for Traefik and Minecraft Bedrock
When deploying Traefik and your Minecraft Bedrock server using Docker Compose, ensure that you correctly expose the UDP port. In your docker-compose.yml
for Traefik, the ports section should include the UDP port mapping:
ports:
- "80:80"
- "443:443"
- "19132:19132/udp"
This line - "19132:19132/udp"
is essential for forwarding UDP traffic from your host machine’s port 19132 to the Traefik container on the same port, specifically for UDP.
For your Minecraft Bedrock server in its docker-compose.yml
(or within the same if you combine them):
version: '3'
services:
minecraft:
image: toasterlint/minecraft_bedrock # Or your preferred image
ports:
- "19132:19132/udp" # Expose UDP port 19132
environment:
EULA: "TRUE" # Accept Minecraft EULA
ALLOW_CHEATS: "TRUE" # Example environment variable
networks:
- proxy # Assuming 'proxy' network is shared with Traefik
networks:
proxy:
external: true # If Traefik and Minecraft are in separate compose files and networks
Alt text: Minecraft Bedrock Edition interface showcasing in-game graphics and user interface elements.
Routing UDP Traffic in Traefik
Unlike HTTP routing, UDP routing in Traefik is simpler. You primarily configure the entry point. You don’t need rules based on Host for UDP as you would for web domains. Traefik will forward UDP traffic arriving at the udpminecraft
entry point to the service associated with it.
In your Minecraft Bedrock Docker Compose (or Traefik configuration labels if using those):
version: '3'
services:
minecraft:
image: toasterlint/minecraft_bedrock
ports:
- "19132:19132/udp"
environment:
EULA: "TRUE"
ALLOW_CHEATS: "TRUE"
networks:
- proxy
labels:
- "traefik.enable=true"
- "traefik.udp.routers.minecraftbedrock.entrypoints=udpminecraft"
- "traefik.udp.routers.minecraftbedrock.service=minecraftbedrock-service"
- "traefik.udp.services.minecraftbedrock-service.loadbalancer.server.port=19132" # Port Minecraft server listens on
networks:
proxy:
external: true
Here, labels are used to define a UDP router and service. traefik.udp.routers.minecraftbedrock.entrypoints=udpminecraft
connects the router to the UDP entry point. traefik.udp.services.minecraftbedrock-service.loadbalancer.server.port=19132
specifies the port within the Minecraft container that Traefik should forward traffic to.
Firewall and DNS Considerations
Ensure your firewall allows UDP traffic on port 19132. For connecting via a “web address,” remember that Minecraft Bedrock doesn’t use web addresses in the same way as web browsers. Players typically connect using the server’s IP address or a hostname that resolves to the server’s IP. DNS records are crucial if you intend to use a domain name instead of a direct IP. You would need an A record pointing your domain or subdomain to your server’s public IP.
Conclusion
Exposing a Minecraft Bedrock server with Traefik requires careful configuration of UDP entry points and correct Docker Compose port mappings. By focusing on UDP configurations and ensuring your firewall and DNS settings are properly set, you can successfully make your Minecraft Bedrock server accessible via the internet using Traefik. Remember to consult the official Traefik documentation for the most accurate and up-to-date information on UDP proxying and service configuration.