GoXLR-on-Linux / goxlr-utility

An unofficial GoXLR App replacement for Linux, Windows and MacOS
MIT License
636 stars 36 forks source link

[BUG] Utility does not bind correctly when localhost is not 127.0.0.1 #91

Closed ThatDawgMeta closed 8 months ago

ThatDawgMeta commented 1 year ago

After editing the host file and binding localhost to a different ip address, the webui does not bind correctly and the browser returns a "Unable to connect to localhost" error.

Operating System: Ubuntu 22.04.2 LTS Utility Version: 0.12.2 GoXLR Type: Mini

Steps to reproduce: -Install GoXLR-Utility -Edit localhost ip in hosts file -Attempt to open webui from the utility

FrostyCoolSlug commented 1 year ago

So it's interesting, it looks like browsers aren't liking the reassignment..

Host File: 192.168.0.10 localhost

Util Starts, binds to localhost (resolved to 192.168.0.10) correctly.. Load the WebUI in chrome, at localhost:14564 (which when resolved SHOULD be 192.168.0.10:14565), but it's getting connection refused (if I do a wget http://localhost:14564 I get the page). As you mentioned on discord, if you go to the IP address defined in your hosts file as localhost, it works correctly.

So what appears to be happening, is that the util is correctly honoring your hosts file and binding appropriately, but Chrome is, for some reason, ignoring it which is why it's unable to connect.

What I'll look into doing just to at least help mitigate this, is that if localhost doesn't resolve to 127.0.0.1, override the host in the settings with the IP address it DOES resolve to, which will allow firing up Chrome to work correctly

ChanoAndersen commented 12 months ago

I'd say it can never be a bug to assume localhost maps to 127.0.0.1 and fail if that's not the case..

The use of the domainname "localhost." is specified in RFC 6761, that clearly states the loopback IP address should be returned. (https://datatracker.ietf.org/doc/html/rfc6761#section-6.3)

If the loopback IP is not returned, the name resolver is defective, and behaves in a non-standard way.

If you get connection refused, when remapping localhost in your hosts file, your local resolver API is misbehaving, by using the IP you've configured in the hosts file.

Also the reason the application does not respond when you change the IP address, is because it's only listening on the loopback interface, most apps using TCP/UDP for local communication does this for security reasons, as it prevents direct remote access. (Though indirect access from malicious websites could still be possible. )

FrostyCoolSlug commented 8 months ago

I'm gonna close this as 'WontFix', @ChanoAndersen is correct, browsers are treating localhost as the local loopback address which is correct behaviour per the spec, and reassigning it to a networked IP is generally bad practice, and comes with issues, this being one of them.

If you need to reassign it for any reason, I'd recommend using a bookmark instead of the tray icon.