docs(nostr): note AUTH ordering and Host-based community routing - #6293
Open
CedricConday wants to merge 1 commit into
Open
docs(nostr): note AUTH ordering and Host-based community routing#6293CedricConday wants to merge 1 commit into
CedricConday wants to merge 1 commit into
Conversation
Two behaviours that cost time when writing a third-party NIP-29 client against a self-hosted relay, neither currently written down. AUTH ordering: the relay challenges proactively on connect, so a client that sends a REQ before completing NIP-42 gets CLOSED: auth-required for that subscription while it is still signing its kind:22242 response. An auth routine reading the same socket discards the CLOSED as unmatched, auth then succeeds, and the subscription is silently gone. It presents as a hang on first query rather than an auth failure. Relay is per-spec here; documenting the ordering requirement and the misleading symptom. Host header: community resolution keys on Host, so any tunnel or proxy that rewrites it gets a 404 on the WebSocket upgrade. The relay's body says 'no community is configured for this host', but most WebSocket clients drop the body on a failed upgrade and surface a bare 404. GET /_liveness and NIP-11 both return 200 for the same wrong Host, so health checks stay green while no client can connect. Added the reproduction, the log line that identifies the registered host, and the proxy config. Verified against ghcr.io/block/buzz:main, relay 0.2.1 (93114c9). Signed-off-by: Cedric Conday <cedric@condaydigital.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two behaviours of a self-hosted relay that aren't documented, both hit while writing a third-party NIP-29 client against
ghcr.io/block/buzz:main(relay 0.2.1,93114c9). Neither is a relay bug — in both cases the relay is correct and the symptom points somewhere else, which is what cost the time.1. AUTH ordering. The relay challenges proactively on connect. A client that opens the socket and sends a
REQimmediately races that challenge: the relay answers the premature subscription withCLOSED: auth-requiredwhile the client is still signing itskind:22242response. An auth routine reading the same socket consumes thatCLOSED, discards it as "not theOKI'm waiting for", and auth then succeeds — but the subscription is gone and noEOSEis coming. It presents as a hang on first query, not an auth error.Distinct from #4498, which is a cold-start timing race in the desktop client (signer not warm inside the 5s window). This one is ordering rather than timing, and reproduces regardless of how fast the client signs.
2. Host-based community routing. Community resolution keys on the
Hostheader, so an SSH tunnel or a misconfigured reverse proxy points at a host with no community and the WebSocket upgrade 404s. The relay's error body is explicit —relay: no community is configured for this host— but most WebSocket client libraries drop the response body on a failed upgrade and surface a bare404.The part that makes this hard to diagnose:
/_livenessand NIP-11 both return200for that same wrongHost. Monitoring reports the relay healthy while nothing can connect through that path.The docs now point at the log line that resolves it, since it names the host each community was registered under:
Docs only — no code changes, no behaviour changes.
Related issue
#4498 — related but distinct (cold-start timing vs. connection ordering); this documents the ordering requirement rather than changing behaviour. No existing issue or PR found for the
Host/proxy case. Adjacent docs work: #3551, #3188.Testing
Both reproductions were run against a single-node
deploy/composestack on relay 0.2.1 (93114c9), withBUZZ_REQUIRE_RELAY_MEMBERSHIP=trueandBUZZ_REQUIRE_AUTH_TOKEN=false. Thecurlsequence above is verbatim output from that host.The AUTH ordering claim was verified by reordering a client that previously hung on its first
REQ: authenticating before subscribing, channel discovery (39000/39002), posting kind:9, reading, NIP-50 search and kind:7 reactions all succeed, with two separate agent identities in one channel.Per
AGENTS.md's Product Contract — this is a docs-only change to the self-hosted third-party-client surface and doesn't contradictVISION_SOVEREIGN.md; if anything the friction it documents is friction against self-hosting. Happy to fold in a "Tested Clients" row, split this into two PRs, or move the content elsewhere ifNOSTR.mdisn't where you want it.