Skip to content

fix: add User-Agent to server-side probes for Cloudflare compatibility#749

Open
craigbidenbot[bot] wants to merge 1 commit intomainfrom
craig/probe-user-agent
Open

fix: add User-Agent to server-side probes for Cloudflare compatibility#749
craigbidenbot[bot] wants to merge 1 commit intomainfrom
craig/probe-user-agent

Conversation

@craigbidenbot
Copy link
Copy Markdown
Contributor

@craigbidenbot craigbidenbot bot commented Mar 28, 2026

Summary

Server-side registration probes fail on endpoints behind Cloudflare Bot Fight Mode because the probe sends no User-Agent header. Cloudflare returns a JS challenge page instead of the 402 response, causing status: null failures.

Changes

  • Add PROBE_USER_AGENT constant (x402scan/1.0 (+https://x402scan.com; server-probe)) and pass it through checkEndpointSchema's headers option on all probes
  • Include the underlying cause/message in probe error strings so failedDetails gives actionable diagnostics instead of just 'No valid x402 response found'

Test Plan

  • Re-register a Cloudflare-tunneled server (e.g. api.leoclaw.cc) — should succeed now that probes include a User-Agent
  • Verify existing registrations still work (User-Agent is additive, no behavior change for non-CF endpoints)
  • Check failedDetails on a deliberately-failing endpoint — error string should now include the cause

Closes #742

Some endpoints behind Cloudflare Bot Fight Mode block requests without a
recognizable User-Agent, causing registration to fail with 'No valid x402
response found' even though the endpoint returns valid 402 challenges.

- Send 'x402scan/1.0 (+https://x402scan.com; server-probe)' on all probes
- Include cause details in probe error messages for better diagnostics

Closes #742
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
x402scan Ready Ready Preview, Comment Mar 28, 2026 10:11pm

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.

Re-registration fails with 'No valid x402 response found' but server-side probe is blocked by Cloudflare

1 participant