Skip to content

Whois: fix ccTLD lookups (RDAP overrides + classic whois fallback) - #1

Merged
chrismuench merged 1 commit into
mainfrom
worktree-fix-whois-rdap-errors
Jul 9, 2026
Merged

Whois: fix ccTLD lookups (RDAP overrides + classic whois fallback)#1
chrismuench merged 1 commit into
mainfrom
worktree-fix-whois-rdap-errors

Conversation

@chrismuench

Copy link
Copy Markdown
Collaborator

Problem

Whois was broken for many ccTLDs (.de, .ch, .io, .eu, .at, .dk, …):

  1. rdap.org only knows TLDs listed in the IANA RDAP bootstrap; for anything else it 404s.
  2. Our function turned that into a 502, and Cloudflare replaces 502/504 bodies with its own bare error code: 502 page — so the JSON error never reached the browser and users saw only "Whois lookup failed (502)".

.com/.net/.org/.uk and IP lookups were unaffected.

Fix

  • RDAP bootstrap overrides — some registries run public RDAP but aren't in the bootstrap. Added a verified map: .de (DENIC), .ch/.li (SWITCH), .io/.sh/.ac (Identity Digital). These now return the normal parsed table.
  • Classic whois fallback (port 43) — TLDs with no RDAP at all (.eu, .at, .dk, .se, .nz, …) now use cloudflare:sockets: query whois.iana.org for the TLD's referral server, then query that server and show the raw whois text in a <pre> with a source note. Strict input validation before anything touches a socket; 64 KB cap; 10 s timeout.
  • Error statuses remapped to 4xx (404 not-found / 429 rate-limit / 424 other) so Cloudflare passes our JSON message through; the frontend now also shows a lookup.icann.org fallback link on any error.

Testing

  • node tests/smoke.mjs — 255 checks pass (new coverage for rdapTarget, rdapFailure, parseWhoisReferral).
  • node tests/e2e.mjs against wrangler pages dev — all 38 checks pass, including new .de override and .eu raw-fallback cases; also manually verified .com, .at, .dk, unregistered domains, and 1.1.1.1.

🤖 Generated with Claude Code

Whois failed for many ccTLDs (.de, .ch, .io, .eu, .at, .dk, …) because
rdap.org only knows TLDs in the IANA RDAP bootstrap, and our 502 error
response was replaced by Cloudflare's bare "error code: 502" page, so
users just saw "Whois lookup failed (502)".

- RDAP_BOOTSTRAP_OVERRIDES: registries that run public RDAP but aren't
  in the bootstrap (de/ch/li via DENIC & SWITCH, io/sh/ac via Identity
  Digital) — verified working and parseable.
- TLDs with no RDAP at all now fall back to classic whois over TCP 43
  (cloudflare:sockets): whois.iana.org referral -> registry server ->
  raw text, rendered in a <pre> with a source note.
- Upstream failures now map to 4xx (404/429/424), never 502/504, so the
  JSON error message survives Cloudflare and reaches the browser; the
  frontend shows it plus a lookup.icann.org fallback link.
- Smoke tests for rdapTarget/rdapFailure/parseWhoisReferral; e2e tests
  for the .de override and .eu raw fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@chrismuench
chrismuench marked this pull request as ready for review July 9, 2026 00:39
@chrismuench
chrismuench merged commit 95a764b into main Jul 9, 2026
6 checks passed
@chrismuench
chrismuench deleted the worktree-fix-whois-rdap-errors branch July 9, 2026 00:39
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