HttpRafa / modflared

Automatically connects you to a Cloudflare tunnel without having to install cloudflared separately.
MIT License
32 stars 6 forks source link

Modflared using different ports; bad handshake #44

Open Caoscrafter44 opened 3 weeks ago

Caoscrafter44 commented 3 weeks ago

Describe the bug I set up an "All The Mods 9 To The Skies" Server on Windows. When I try to connect to the server I get "Internal Excaption: java.net.SocketException: Connection reset". The minecraft log shows that it tries to connect to the wrong port. The server is listening on port 25565 but always uses a different port. Cloudflared is configured manually on the Server and all DNS entries are set like the example.

Which version of the mod/game are you using? I am using minecraft 1.20.1 with the ATM 9 To The Skies Modpack and modflared release 61 from modrinth.

To Reproduce Steps to reproduce the behavior:

  1. Start game
  2. Click on refresh
  3. connect to server
  4. See error in console

Expected behavior connecting to server

Additional context

cloudflare config: hostname: play.example.de service: tcp://127.0.0.1:25565

Minecraft log: Connecting to play.example.de, 25565 Starting tunnel to play.example.de [cloudflared-windows-amd64.exe access tcp --hostname play.example.de --url 127.0.0.1:27046] 2024-07-01T19:04:35Z INF Start Websocket listener host=127.0.0.1:27046 2024-07-01T19:04:36Z ERR failed to connect to origin error="websocket: bad handshake" originURL=https://play.example.de Stopping tunnel to /127.0.0.1:27046

HttpRafa commented 3 weeks ago

Modflared selects a random port when connecting to a server, which is used for local communication between Minecraft and Cloudflared. The error looks like your tunnel configuration is not correct. Are you sure that your tunnel points to 127.0.0.1:port of server and is entered as a DNS record?

HttpRafa commented 3 weeks ago

Could you send me a screenshot of the dns records and of the tunnel configuration.

Caoscrafter44 commented 3 weeks ago

Tried using the remote-managed tunnel with same outcome. TUNNEL Tunnel_CNAME Tunnel_TXT

HttpRafa commented 3 days ago

I've tested it several times and it seems to work for me. What you can try is deleting the tunnel and setting it up again.

HttpRafa commented 3 days ago

The problem lies more with the configuration of the tunnel. The DNS and mod seem to work well, which can be seen from the messages "Starting tunnel to play.example.de [cloudflared-windows-amd64.exe access tcp --hostname play.example.de --url 127.0.0.1:27046] 2024-07-01T19:04:35Z INF Start Websocket listener host=127.0.0.1:27046".