Skip to content

fix: use localhost instead of 127.0.0.1 in local-node browser links#58

Merged
sanity merged 1 commit into
mainfrom
fix-river-localhost-windows
Jun 2, 2026
Merged

fix: use localhost instead of 127.0.0.1 in local-node browser links#58
sanity merged 1 commit into
mainfrom
fix-river-localhost-windows

Conversation

@sanity

@sanity sanity commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Problem

The "Open River & Join Chat" invite button (river-invite-button.html) and the Ghost Key "Import to Freenet" button (donation-success.js) hand the browser a literal http://127.0.0.1:7509/ URL pointing at the user's local Freenet node.

On Windows, opening this URL fails with "can't access this site." Replacing 127.0.0.1 with localhost makes it work. This was reported in gigazine.net's River writeup, where the author had to hand-edit 127.0.0.1localhost to reach the official chat room.

Root cause

Since the dual-stack change (freenet-core #3648), the node binds its local HTTP/WS API on the IPv6 loopback by default (::1 in local mode, :: in network mode) with IPV6_V6ONLY=false.

  • On Linux, the dual-stack socket also accepts IPv4-mapped connections, so 127.0.0.1 works.
  • On Windows, that path is unreliable and the socket is effectively IPv6-only for inbound, so the literal IPv4 address is refused — while localhost (which Windows resolves to ::1) connects.

Approach

Use localhost rather than the literal 127.0.0.1 for the two browser-facing links. localhost is correct on every platform: the browser resolves it to whichever loopback the node is actually listening on. River's UI derives its WebSocket URL from window.location.host (ui/src/components/app/freenet_api/constants.rs), so loading the page from localhost:7509 makes the follow-on WS connection use localhost too — the fix propagates without any River change.

Scope / not changed

  • publish-a-website.md shows literal fdev terminal output (Website URL: http://127.0.0.1:7509/...) and documents fdev's default connection. Changing the docs would misrepresent what the tool prints — the proper fix is in fdev/freenet-core.
  • install.sh dashboard message is the Unix curl | sh installer (Windows users don't run it; 127.0.0.1 works on Linux).
  • remote-access.md 127.0.0.1 references are SSH-tunnel/config context and correct as-is.
  • Deeper fix (separate, freenet-core): binding the loopback API dual-stack (both 127.0.0.1 and ::1) — or reverting the loopback default to IPv4 on Windows — would make the literal IPv4 address work again. Tracked separately; this PR resolves the user-visible symptom for the website's links.

Testing

  • node --check passes on donation-success.js.
  • Verified River's WS URL is host-relative, so localhost propagates to the WebSocket connection.
  • Prettier warnings on both files are pre-existing (present on main) and not gated by CI; left untouched to keep the diff minimal.

[AI-assisted - Claude]

🤖 Generated with Claude Code

The "Open River & Join Chat" invite button and the Ghost Key "Import to
Freenet" button hand the browser a literal http://127.0.0.1:7509/ URL
pointing at the user's local Freenet node. On Windows this fails with
"can't access this site"; replacing 127.0.0.1 with localhost works.

Root cause: since the dual-stack change (freenet-core #3648), the node
binds its local HTTP/WS API on the IPv6 loopback by default (::1 in local
mode, :: in network mode) with IPV6_V6ONLY=false. On Linux the dual-stack
socket also accepts IPv4-mapped connections, so 127.0.0.1 works there. On
Windows that path is unreliable and the socket is effectively IPv6-only
for inbound, so the literal IPv4 address is refused while "localhost"
(which Windows resolves to ::1) connects.

Using localhost is correct on every platform: the browser resolves it to
whichever loopback the node is actually listening on. River's UI derives
its WebSocket URL from window.location.host, so loading the page from
localhost:7509 makes the follow-on WS connection use localhost too.

Reported via gigazine.net's River writeup, where the author had to edit
127.0.0.1 to localhost by hand to reach the chat on Windows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sanity sanity merged commit 2e02b14 into main Jun 2, 2026
3 checks passed
@sanity sanity deleted the fix-river-localhost-windows branch June 2, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant