fix(x402): public path + https in 402 resource.URL#760
Merged
Conversation
Dedicated-origin routes rewrite /path into /services/<name>/path before the verifier; challenges still advertised the internal path. Also default public hosts to https so TLS-terminated tunnels do not leak http:// resource URLs that break x402scan discovery.
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
Dedicated hostname path rewrite: Traefik rewrites
/audit→/services/<name>/auditbefore the verifier; 402resource.URLstill used the rewritten path while discovery advertised the public URL. Challenges now strip the internal prefix when the request host matches the offer hostname (same logic as SIWX).HTTPS for public hosts:
buildResourceURLdefaulted tohttpunlessX-Forwarded-Proto: https. Tunnel TLS termination often leaves proto as http → x402scan saw http challenges for https discovery. Align withresolveSiteURL(default https for non-local hosts).Test plan
go test ./internal/x402/ -run TestBuildResourceURLgo test ./internal/x402/Part of v0.14.0-rc0 hackathon bugfix train.