fix: add User-Agent to server-side probes for Cloudflare compatibility#749
Open
craigbidenbot[bot] wants to merge 1 commit intomainfrom
Open
fix: add User-Agent to server-side probes for Cloudflare compatibility#749craigbidenbot[bot] wants to merge 1 commit intomainfrom
craigbidenbot[bot] wants to merge 1 commit intomainfrom
Conversation
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
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
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: nullfailures.Changes
PROBE_USER_AGENTconstant (x402scan/1.0 (+https://x402scan.com; server-probe)) and pass it throughcheckEndpointSchema'sheadersoption on all probesfailedDetailsgives actionable diagnostics instead of just'No valid x402 response found'Test Plan
api.leoclaw.cc) — should succeed now that probes include a User-AgentfailedDetailson a deliberately-failing endpoint — error string should now include the causeCloses #742