[Bug] deploy/compose: default BUZZ_CORS_ORIGINS omits Tauri webview origins — desktop "Join an existing community" fails with "Load failed"
Summary
A relay deployed from the deploy/compose template blocks the desktop app at CORS preflight. The template ships
BUZZ_CORS_ORIGINS=https://buzz.example.com
(operators substitute their own domain), but the desktop app's WebView runs from origin tauri://localhost (macOS/Linux) or http://tauri.localhost (Windows). Since neither is in the allowlist, the WebView's HTTP API calls to the relay are rejected, and "Join an existing community" fails with WebKit's generic Load failed.
What makes this confusing to debug: curl and NIP-11 checks against the same relay succeed, so the relay looks perfectly healthy from everywhere except the app.
Environment
- Buzz Desktop v0.4.26 (macOS)
- Relay
ghcr.io/block/buzz@sha256:77e1c6b1…, self-hosted viadeploy/composewith Caddy TLS
Steps to reproduce
- Fresh
deploy/composedeployment: copy.env.example→.env, setBUZZ_CORS_ORIGINS=https://<your-domain>per the template. - Desktop app → Add community → Join an existing community → enter the relay URL.
- Join fails with
Load failed. curl -H 'Accept: application/nostr+json' https://<your-domain>returns the NIP-11 document fine.
Cause
The relay parses BUZZ_CORS_ORIGINS as a comma-separated list of exact origins (crates/buzz-relay/src/config.rs) and build_cors_layer in crates/buzz-relay/src/router.rs deliberately does not fall back to permissive CORS when the variable is set. That behavior is sensible — the problem is only that the compose template's default value omits the desktop origins, so every self-hosted deployment configured from it breaks the desktop app.
Suggested fix
Include the desktop origins in the template default:
BUZZ_CORS_ORIGINS=https://buzz.example.com,tauri://localhost,http://tauri.localhost
and add a short note to deploy/compose/README.md (currently silent on CORS) that the Tauri origins must stay in the allowlist for the desktop app to work against a self-hosted relay.
Verified on the deployment above: adding those two origins and restarting the relay resolves the join failure.
Related (not duplicates)
- #2617 documents
BUZZ_CORS_ORIGINS+ the Tauri origins, but in the root.env.example— the value shipped bydeploy/compose/.env.exampleis unchanged. - #2862 moves the join-policy fetch to native networking, which would bypass CORS for direct relay-URL joins — but other WebView HTTP calls (e.g. invite minting/redemption, moderation) still need these origins allowlisted, so the compose default remains a footgun even after it lands.
I'm hitting this issue so I tried making the changes described here:
# Public host name. Used by compose.caddy.yml and URL-derived settings below.
BUZZ_DOMAIN=buzz.lan
RELAY_URL=ws://buzz.lan
BUZZ_MEDIA_BASE_URL=http://buzz.lan/media
BUZZ_MEDIA_SERVER_DOMAIN=buzz.lan
BUZZ_CORS_ORIGINS=http://buzz.lan,tauri://localhost,http://tauri.localhost
However, after force-recreating the containers (docker compose up -d --force-recreate) and verifying both of those origins work (if I send curl commands with any of those origins, they come back in the headers), the app continues to say "Load failed" when I enter http://buzz.lan in the "Join Community" page. (I can access it fine in the browser, and get the json).
Is there anything else required? Is there any way to get some kind of developer tools for the app that might help debug? (I can do this in electron apps, but nothing I tried from their docs of ChatGPTs suggestions worked here).
Slightly more confusingly - I tried entering the IP address instead of the hostname, and I got to the next step where it asked for my name. But then it failed submitting that with "relay returned 404 Not Found: relay: no community is configured for this host".
I guess the error message ("relay: no community is configured for this host") served when you don't send the right hostname does not have CORS configured, and the desktop app doesn't detect that it's returning "relay: no community is configured for this host" so let you attempt the next step.
This does make me think it's still a CORS issue, but I haven't been able to find any combination of logging on the relay that shows anything when the desktop attempts to connect.
Edit: I temporarily tried BUZZ_CORS_ORIGINS=*, BUZZ_CORS_ORIGINS= and just commenting out the line, but also no difference.
Edit2: I decided to try on my Windows PC, and it connects fine from there. So whatever my issue is, seems to be specific to macOS (or at least, my MacBook 🙃)
Edit3: I installed Charles Proxy, and no matter what URL I type in the input box, no requests every show up on macOS. It makes me wonder if DNS is failing rather than the connection. It's probably unrelated to this issue.
Edit4: I filed https://github.com/block/buzz/issues/2977 for my issue, because I think it's unrelated to this one/CORS.
Hit this on a fresh deploy/compose self-host today — same root cause, different
symptom: with the shipped BUZZ_CORS_ORIGINS default, joining worked but minting
an invite failed. /api/invites goes through the webview's fetch(), while
/query and /events go through the Tauri native side and bypass CORS entirely,
so the relay looks completely healthy while parts of the app silently don't work.
getJoinPolicy and acceptJoinPolicy are on the same webview path.
Adding tauri://localhost,http://tauri.localhost fixed it, so #2888 / #3595 would
have covered me.
Filed #3636 separately for the diagnosability side. It also answers your note about
not finding any combination of relay logging that shows anything: CorsLayer is
applied outside http_trace_layer() (crates/buzz-relay/src/router.rs:189-192), so
a rejected preflight is answered before it ever reaches the trace layer — no log line
is possible at any level. Not a duplicate of this issue; that half stays broken for
any other origin mismatch even after the default is fixed.
Independent reproduction, on macOS and on a recent image — this is still live.
Environment: relay ghcr.io/block/buzz:sha-00e61ea (28 Aug), deploy/compose single node behind
Traefik, desktop 0.5.20 on macOS (Apple Silicon). The reported symptom is exact: clicking
Accept invite in Buzz from the /invite/<code> landing page opens the app, which shows
Joining buzz → Load failed and nothing else.
Isolating it took one control test. Everything else was healthy — DNS resolved, TLS verified,
/_liveness returned 200 in 20 ms, and a WebSocket upgrade over the same hostname returned 101. The
difference was visible only in the preflight:
OPTIONS /api/invites/claim
Origin: https://<relay-host> → 200 + access-control-allow-origin: https://<relay-host> ✅
Origin: tauri://localhost → 200, no access-control-allow-origin ❌
Origin: http://tauri.localhost → 200, no access-control-allow-origin ❌
Without the header the WKWebView discards the response and fetch() throws — and Load failed is
literally WebKit's string for that, which is why the message points nowhere near CORS.
Fix confirmed: adding tauri://localhost to BUZZ_CORS_ORIGINS and restarting the relay. The
preflight then returns the header and the invite claim completes. macOS only needed
tauri://localhost; http://tauri.localhost (the origin in #3490) was not required here.
What made this expensive to diagnose is worth adding to the case for fixing the shipped example:
crates/buzz-relay/src/config.rs documents the correct value inline —
/// Example: "tauri://localhost,http://localhost:3000"
— while deploy/compose/.env.example ships BUZZ_CORS_ORIGINS=https://buzz.example.com alone. An
operator following the deployment bundle end to end gets a stack where every health check passes and
the official desktop client cannot join, with an error string that suggests a network fault. The
correct value already exists in the codebase; it just isn't in the file operators copy.
Happy to send a PR adding the Tauri origins to deploy/compose/.env.example with a short comment, if
that is welcome.