Repository navigation
fix(favicon): don't retry absolute favicon hrefs as a path on the target - #2681
Merged
Mzack9999 merged 1 commit intoOct 23, 2026
Conversation
When a favicon href without a leading slash failed to fetch, the root fallback requested "/" + href on the base URL. For an absolute href such as http://cdn.example.com/icon.png that meant a request for /http://cdn.example.com/icon.png on the target, which never returns the icon and spends a request per target. Only fall back for relative hrefs.
Mzack9999
reviewed
Oct 23, 2026
Mzack9999
left a comment
Member
There was a problem hiding this comment.
The extra request is real. An absolute favicon href that fails is retried as a path on the target. The new test fails on dev with GET /http://127.0.0.1:1/icon.png and passes once the fallback checks IsAbs. Relative hrefs still fall back. Linked #2682.
CI had not run because the workflows were waiting on a first-time contributor approval.
Mzack9999
approved these changes
Oct 23, 2026
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.
Fixes #2682
What
When a favicon fetch fails and the href has no leading slash,
HandleFaviconHashretries it as"/" + rawfrom the root. That fallback is meant for directory-relative hrefs likeicon.png, but it also runs for absolute hrefs. Withan unreachable icon host makes httpx send this request to the target:
It can never return the icon. It costs one extra request per target and shows up as a strange 404 in the target's logs. This PR skips the fallback when the parsed href is absolute (
url.URL.IsAbs()). Relative hrefs behave as before.Test
TestFaviconAbsoluteHrefIsNotRetriedAsRootPathruns a full enumeration against anhttptestserver and records the request paths.devit fails:paths=["/" "/http://127.0.0.1:1/icon.png"]./is requested.go test ./runner/passes.Independent of #2680 (same function, different lines).
AI disclosure
I used Claude Code to help read the code and write the test. I checked that the test fails on
devand passes with the fix myself.Summary by CodeRabbit