Skip to content

fix(localnet): route bare wallet URLs to each role's wallet - #279

Merged
zheli merged 1 commit into
mainfrom
fix-wallet-urls
Jul 14, 2026
Merged

fix(localnet): route bare wallet URLs to each role's wallet#279
zheli merged 1 commit into
mainfrom
fix-wallet-urls

Conversation

@zheli

@zheli zheli commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Problem

The wallet URLs DevKit advertises for the app-provider and sv roles don't reach the wallet:

  • app-provider (http://localhost:52343) served the Amulet Name Service instead of the wallet.
  • sv (http://localhost:52344) returned HTTP 404.

Root cause

Splice's nginx routes by Host header. The bare host URL DevKit advertises (http://localhost:<UI_PORT>) matches no *.localhost vhost, so nginx falls through to the first server block on the port:

  • app-provider: first block is ans.localhost -> name service.
  • sv: catch-all server_name localhost _ -> non-existent static dir /usr/share/nginx/sv-html -> 404.

app-user already worked because its wallet block listed server_name localhost wallet.localhost.

Fix

The upstream .conf files live in the content-hash-verified Splice cache (shared across all 0.6.12 instances), so editing them in place risks a hash mismatch and isn't per-instance safe.

Instead:

  • Ship DevKit-owned copies of the three role configs as embedded assets (assets/nginx/*.conf), adding localhost to each wallet server block and dropping localhost from the sv catch-all.
  • Bind-mount them over the upstream templates via a per-instance compose overlay (WriteNginxVhostOverlay), mirroring the existing loopback-ports / container-rename overlay pattern (volumes: !override).
  • nginx.conf and includes/ are unchanged upstream, so the overlay keeps those pointed at the untouched cache (${LOCALNET_DIR}).

The overlay is edit-preserving: an operator who tweaks a materialized .conf keeps that tweak across localnet up.

Verification

go build ./... + go test ./... (1535 passed). Re-upped localnet-2 with the new binary and probed the bare host URLs:

URL Before After
localhost:52342 (app-user) 200 wallet 200 wallet
localhost:52343 (app-provider) 200 ANS 200 wallet
localhost:52344 (sv) 404 200 wallet

No regressions: ans.localhost:52343, scan.localhost:52344, and sv.localhost:52344 vhosts all still return 200. All three bare wallet URLs serve the same wallet bundle (index-V6UCL5Qo.js) confirmed via Host: wallet.localhost reference.

Splice's nginx routes by Host header. The bare host URL DevKit
advertises (http://localhost:<UI_PORT>) matches no *.localhost vhost, so
nginx falls through to the first server block on the port:

  - app-provider (52343): first block is ans.localhost -> served the
    Amulet Name Service instead of the wallet.
  - sv (52344): catch-all `server_name localhost _` served a
    non-existent static dir (/usr/share/nginx/sv-html) -> HTTP 404.

app-user already worked because its wallet block listed
`server_name localhost wallet.localhost`.

The upstream .conf files live in the content-hash-verified Splice cache
(shared across all instances), so editing them in place risks a hash
mismatch and is not per-instance safe. Instead, ship DevKit-owned copies
as embedded assets and bind-mount them over the upstream templates via a
per-instance compose overlay (WriteNginxVhostOverlay), mirroring the
existing loopback-ports/container-rename overlay pattern.

The DevKit copies add `localhost` to each wallet server block and drop
`localhost` from the sv catch-all. nginx.conf and the includes/ dir are
unchanged upstream, so the overlay keeps those pointed at the cache.

Verified end-to-end against localnet-2: all three bare wallet URLs now
return HTTP 200 and serve the wallet bundle, with ans.localhost,
scan.localhost, and sv.localhost vhosts still routing correctly.
@cursor

cursor Bot commented Jul 14, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@zheli
zheli merged commit d7e760c into main Jul 14, 2026
4 checks passed
@zheli
zheli deleted the fix-wallet-urls branch July 14, 2026 19:59
@zheli

zheli commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Fixes issue #235

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