Skip to content

fix(x402): public path + https in 402 resource.URL#760

Merged
bussyjd merged 1 commit into
integration/v0.14.0-rc0from
fix/x402-public-resource-url
Jul 15, 2026
Merged

fix(x402): public path + https in 402 resource.URL#760
bussyjd merged 1 commit into
integration/v0.14.0-rc0from
fix/x402-public-resource-url

Conversation

@bussyjd

@bussyjd bussyjd commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  1. Dedicated hostname path rewrite: Traefik rewrites /audit/services/<name>/audit before the verifier; 402 resource.URL still 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).

  2. HTTPS for public hosts: buildResourceURL defaulted to http unless X-Forwarded-Proto: https. Tunnel TLS termination often leaves proto as http → x402scan saw http challenges for https discovery. Align with resolveSiteURL (default https for non-local hosts).

Test plan

  • go test ./internal/x402/ -run TestBuildResourceURL
  • Full go test ./internal/x402/

Part of v0.14.0-rc0 hackathon bugfix train.

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.
@bussyjd
bussyjd merged commit e13d8d0 into integration/v0.14.0-rc0 Jul 15, 2026
@bussyjd bussyjd mentioned this pull request Jul 15, 2026
6 tasks
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