Skip to content

Favicon extraction fails with follow-redirects when host changes #2373

@coderabbitai

Description

@coderabbitai

Description

When using -favicon with -follow-redirects, favicon extraction fails if the redirect changes the host. The issue occurs because the code clones the original request to fetch the resolved favicon URL but does not update the cloned request's Host header after redirects.

Reproduction

Without follow-redirects (works):

echo "https://hackerone.com" | httpx -favicon -json | jq '.favicon'
# Returns: "595148549"

With follow-redirects (fails):

echo "https://hackerone.com" | httpx -favicon -follow-redirects -json | jq '.favicon'
# Returns: null

Root Cause

When the target redirects to a different host (e.g., hackerone.com → www.hackerone.com), the resolved favicon URL points to the final host but the cloned request still has the original Host header, causing the server to return 404 and favicon to be null.

Related PR

Fix implemented in PR #2369 by @wlayzz


Reported by: @Mzack9999
PR: #2369

Metadata

Metadata

Assignees

Labels

Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions