Skip to content

Avoid redirect when checking HTTPS address hints - #77

Merged
yschimke merged 1 commit into
mainfrom
agent/fix-address-hint-reachability
Aug 15, 2026
Merged

Avoid redirect when checking HTTPS address hints#77
yschimke merged 1 commit into
mainfrom
agent/fix-address-hint-reachability

Conversation

@yschimke

Copy link
Copy Markdown
Owner

Summary

  • use Cloudflare's non-redirecting /cdn-cgi/trace endpoint when checking HTTPS-record address hints
  • document why following /robots.txt is unsafe with the test's pinned DNS implementation

Root cause

cloudflare.com/robots.txt redirects to www.cloudflare.com/robots.txt. The test DNS implementation deliberately returns the selected cloudflare.com address hint for every lookup, so OkHttp reused that address for the redirected hostname. Cloudflare rejected the mismatched www.cloudflare.com request with HTTP 403 (error code: 1034) even though the original address hint was reachable.

Impact

The reachability finding no longer reports a false failure caused by a cross-host redirect. It still requires a successful HTTP 200 response through the selected HTTPS-record address hint.

Validation

  • ./gradlew :network:networkTest --tests 'okhttp.testbed.network.HttpsRecordTest.addressHintsAreReachable' -PokhttpVersion=5.5.0-SNAPSHOT --rerun-tasks
  • reproduced the previous 403 and verified the non-redirecting endpoint returns 200 with curl

@yschimke
yschimke marked this pull request as ready for review August 15, 2026 21:08
@yschimke
yschimke merged commit 140fee8 into main Aug 15, 2026
4 checks passed
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