Trying to tunnel Minecraft

Hello, I’ve been trying for several days to establish a tunnel with my Minecraft server (non-HTTP) to a subdomain. I’ve read the non-HTTP documentation and several forums, but I can’t get it to work. I think I’m forgetting something or doing something wrong. The server works fine locally.

Procedure:

Server:

  1. I create the tunnel using Cloudflare’s web interface (/networks/tunnels).
  2. I download Cloudflared.
  3. I establish the tunnel: sudo cloudflared service install {token}.
  4. I add the DNS CNAME record: minecraft.{mydomain}.com pointing to {id_tunnel}.cfargotunnel.com.

Output:

shell

Copiar código

2024-08-09T21:50:49Z INF Using SysV
2024-08-09T21:50:49Z INF Linux service for cloudflared installed successfully

Client (Windows desktop):

  1. I download Cloudflared.
  2. I run cloudflared access tcp --hostname minecraft.{mydomain}.com --url localhost:25565.

Output:

shell

Copiar código

2024-08-09T21:43:04Z INF Start Websocket listener host=localhost:25565

When I try to connect with the Minecraft client, it says “connection refused.”

I tried checking if there is any trace using the following command:

powershell

Copiar código

Test-NetConnection -ComputerName localhost -Port 25565 -InformationLevel Detailed

Warning:

shell

Copiar código

TCP connect to (::1 : 25565) failed

Cloudflared logs:

shell

Copiar código

2024-08-09T21:51:47Z ERR failed to connect to origin error="dial tcp: lookup fastminecraft.{mydomain}.com: getaddrinfow: The requested name is valid, but no data of the requested type was found." originURL=https://minecraft.{mydomain}.com

I can trace the domain, but I can’t connect to Minecraft. What might I be overlooking?

hi did u ever figure out how to get this working im trying the same thing with a sock error on connect

Wondering the same thing and come across this post and your comment.

I have a domain that I own,

I managed to get this working but having a few technical difficulties with it, will require confirmation from players tomorrow to see if its on my end or theirs, I can connect to the server locally and via mc. but having connection issues on my end, but when I join via its local IP: 192.168.0.183:25565 I have no problems.

You can definitely tunnel a minecraft server, but I’m still in the process of working out fixing issues.

Did you ever get a reply from your players if it worked?

Yeah I did.

So it’s not possible to do this through a tunnel.

But you can use Cloudflare Spectrum which is essentially made for Minecraft servers. It does cost, but not much. Other then that the only thing you can do is, get a Static IP from your ISP and run it through spectrum (or your exposing your IP), and point your domain to it, so for me:

mc.braydon.id.au (just an example) points to my Public IP Address.

All other services like Crafty Controller and BlueMap have no issues with being connected through a tunnel. I think its just TCP/UDP traffic that has issues.