BlueMap-Minecraft / BlueMap

A Minecraft mapping tool that creates 3D models of your Minecraft worlds and displays them in a web viewer.
https://bluecolo.red/bluemap
MIT License
1.76k stars 114 forks source link

BlueMap webserver immediately closes client connection when bound to 127.0.0.1 #527

Closed globau closed 3 months ago

globau commented 3 months ago

Steps to reproduce

Add the following lines to webserver.conf:

# Bind IP address
ip: 127.0.0.1

Expected result

Fully functional webserver, bound to 127.0.0.1 instead of all interfaces.

Actual result

debug.log shows that it's bound to 127.0.0.1:

[2024-03-20 11:57:14][INFO] WebServer bound to: /127.0.0.1:8100
[2024-03-20 11:57:14][INFO] WebServer started.

Connecting to http://127.0.0.1:8100/ in a browser (from the same system that's running MC of course) results in:

The connection to the server was reset while the page was loading.

A telnet test shows the that the connection is immediately dropped:

$ telnet 127.0.0.1 8100
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

Context

BlueMap Version: 4.0-paper

TBlueF commented 3 months ago

I can not reproduce your issue, i can connect and view the map without any issues when binding to ip: "127.0.0.1" specifically.. And i guess telnet is not working because bluemaps integrated webserver is dropping all connections that are not http. Internally there is really no difference in how bluemap's webserver acts no matter which ip it is bound to, so my best guess is that you have some networking issues on your end. Or can you provide me with any way to reproduce this on my end?

globau commented 3 months ago

Thanks for the quick response.

telnet is protocol agnostic, it just opens a socket (once connected you can type the raw HTTP request such as GET /).

I see the same with curl:

$ curl http://127.0.0.1:8100/
curl: (56) Recv failure: Connection reset by peer

Internally there is really no difference in how bluemap's webserver acts no matter which ip it is bound to

Yeah, I was surprised by this outcome.

my best guess is that you have some networking issues on your end

At first I thought it was local, however that I see the same behaviour on two very different systems (macOS and Linux) points to something else.

I run webservers bound to localhost on a daily basis as part of my regular software development; no problems with any of those.

Or can you provide me with any way to reproduce this on my end?

Love to, but not sure where else to go.

As you can't reproduce it, I'll pull down the code and see if I can diagnose this.

globau commented 3 months ago

This bug is invalid; sorry about the noise.

I'm running MC within a Docker container, so its localhost wasn't the host's localhost. d'oh!

What I've done instead is use ip: "#getLocalHost" which selects the correct interface.

TBlueF commented 3 months ago

No worries! Glad you figured it out :) And you are the first to use that hidden #getLocalHost setting, that i added but never documented anywhere ;D