Skip to content

Skip favicon fetch from DuckDuckGo for localhost URLs #137

@bnema

Description

@bnema

Problem

When navigating to localhost URLs, the browser unnecessarily attempts to fetch favicons from DuckDuckGo's favicon API:

DBG fetching favicon from DuckDuckGo url=https://icons.duckduckgo.com/ip3/localhost%3A5173.ico

This is wasteful since:

  1. DuckDuckGo cannot return a favicon for localhost
  2. It adds unnecessary network latency
  3. It may cause timeout delays

Proposed Solution

Add a check in internal/infrastructure/favicon/fetcher.go at the start of the Fetch() function to skip fetching for local domains:

  • localhost
  • 127.0.0.1
  • ::1
  • Optionally: *.local, 192.168.*, 10.*, 172.16-31.* (private IP ranges)

Implementation Hint

func isLocalDomain(domain string) bool {
    // Check for localhost variants and private IPs
    // Return true to skip external fetch
}

Add the check around line 39-41 in fetcher.go, before the DuckDuckGo request is made.

Files to Modify

  • internal/infrastructure/favicon/fetcher.go

Acceptance Criteria

  • No DuckDuckGo fetch attempt for localhost URLs
  • No DuckDuckGo fetch attempt for 127.0.0.1 URLs
  • No DuckDuckGo fetch attempt for ::1 URLs
  • Existing favicon fetching for public domains still works

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions