mirror of
https://github.com/projectdiscovery/httpx
synced 2026-06-08 16:50:17 +00:00
fix: update Host header for favicon requests after redirects
When FollowRedirects is enabled and the target redirects to a different host (e.g., hackerone.com -> www.hackerone.com), the favicon URL is correctly resolved to the final host, but the cloned request's Host header still contains the original host. This causes the server to return 404 because the Host header doesn't match the URL. This fix updates the Host header to match the resolved URL host before making the favicon request.
This commit is contained in:
@@ -2611,6 +2611,10 @@ func (r *Runner) HandleFaviconHash(hp *httpx.HTTPX, req *retryablehttp.Request,
|
||||
}
|
||||
|
||||
clone.SetURL(resolvedURL)
|
||||
// Update Host header to match resolved URL host (important after redirects)
|
||||
if resolvedURL.Host != "" && resolvedURL.Host != clone.Host {
|
||||
clone.Host = resolvedURL.Host
|
||||
}
|
||||
respFav, err := hp.Do(clone, httpx.UnsafeOptions{})
|
||||
if err != nil || len(respFav.Data) == 0 {
|
||||
tries++
|
||||
|
||||
Reference in New Issue
Block a user