Skip to content

fix(favicon): keep the browser's cached icon when it revalidates - #389

Merged
PascaleBeier merged 1 commit into
HitKeep:mainfrom
joshpurvis:fix/favicon-revalidation
Oct 4, 2026
Merged

PascaleBeier merged 1 commit into
HitKeep:mainfrom
joshpurvis:fix/favicon-revalidation

Conversation

@joshpurvis

Copy link
Copy Markdown
Contributor

Summary

Site favicons in the dashboard turn into the globe fallback about a day after they first load, and a hard reload doesn't bring them back.

When the browser rechecks a cached icon, it sends If-None-Match / If-Modified-Since. The proxy forwards those to DuckDuckGo, which answers 304 Not Modified. ModifyResponse treated every non-2xx answer as "no icon" and turned the 304 into an empty 204 with Cache-Control: public, max-age=86400. The browser then cached that empty response in place of the icon for another day. A hard reload doesn't help, because the dashboard adds its icons after the page has loaded, so they come from the cache.

What changed

  • server/sites/favicon_handlers.go: a 304 now passes through unchanged. Other non-2xx answers still become an empty 204, so the dashboard shows its fallback when there's no icon.
  • server/sites/handlers_test.go: a test that the browser's validator reaches the upstream request and the 304 comes back.

To reproduce against a running instance:

curl -sI https://<instance>/api/favicon/github.com
curl -s -o /dev/null -w '%{http_code}\n' -H 'If-Modified-Since: <Last-Modified from above>' https://<instance>/api/favicon/github.com

Before this change the second command prints 204. With it, the command prints 304.

Browsers that already cached an empty response keep it until it expires (up to a day) or their cache is cleared.

Testing

  • go test -race ./server/sites -run Favicon passes.
  • I haven't run the full hk QA profile.
  • I'm running this on my own instance, on top of 2.14.0.

Contributor Checklist

  • I updated docs or explained why docs are not needed.
  • I updated OpenAPI sources if public API shape changed.
  • I checked MCP read-only/privacy boundaries if MCP behavior changed.
  • I updated Agent Skills if MCP tools, filters, metrics, or guidance changed.
  • I checked GoAI structured-output validation if AI provider or Opportunity behavior changed.
  • I checked the diff for secrets, private deployment details, local-only paths, and customer data.

No docs, OpenAPI, MCP, Agent Skills or AI changes. The only visible difference is that icons no longer disappear. /api/favicon/{domain} can now also answer 304 to a conditional request.

Site favicons disappeared from the dashboard about a day after they were
first loaded. When the browser rechecked its cached icon, DuckDuckGo
answered "not modified", and the proxy turned that into an empty response
the browser then cached for a day in place of the icon.

The proxy now passes 304 Not Modified through unchanged; other non-2xx
answers still become an empty 204 so the dashboard shows its fallback.

Browsers that already cached the empty response keep it until it expires
(up to a day) or their cache is cleared.
@PascaleBeier

Copy link
Copy Markdown
Collaborator

Thanks a lot for that, looks good 🙂

@PascaleBeier
PascaleBeier merged commit ddb7862 into HitKeep:main Oct 4, 2026
17 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.

2 participants