Skip to main content
The Icons service fetches and caches website favicons for vault login items, providing visual identification in the Bitwarden interface.

Overview

The Icons service provides:
  • Favicon Fetching: Retrieve website favicons and icons
  • Multiple Strategies: Try multiple icon sources (favicon.ico, manifest, meta tags)
  • Caching: In-memory cache for frequently requested icons
  • Domain Mapping: Handle special cases and CDN redirects
  • Fallback Icon: Default icon for failed requests
  • Performance: Fast icon delivery with minimal overhead

Architecture

Configuration

From src/Icons/Startup.cs:23:
Service Configuration

Icon Endpoint

From src/Icons/Controllers/IconsController.cs:55:
Icon Retrieval
Endpoint: GET /{hostname}/icon.png Example: GET /github.com/icon.png Response: Image file (PNG, ICO, SVG, etc.)

Icon Fetching Strategies

The service tries multiple strategies to find icons:
1

Favicon.ico

Try standard /favicon.ico location
2

Web Manifest

Parse /manifest.json for icon URLs
3

HTML Meta Tags

Parse HTML for icon meta tags (<link rel="icon">)
4

Apple Touch Icon

Try Apple-specific touch icons
5

Fallback

Return default Bitwarden globe icon

HTML Parsing

HTML Icon Extraction

Caching Strategy

Memory Cache

Icons are cached in memory with size limits:
Cache Configuration

Cache Rules

From src/Icons/Controllers/IconsController.cs:91:
Cache Logic
Cache Settings:
  • Duration: Configurable hours (default: 24 hours)
  • Size Limit: Total cache size limit
  • Entry Size: Large icons (>50KB) not cached
  • Priority: Not found results cached with high priority

Domain Mapping

Special domain handling for popular services:
Domain Mapping

Fallback Icon

From src/Icons/Controllers/IconsController.cs:14:
Default Icon
The fallback is a base64-encoded Bitwarden globe icon (bwi-globe) displayed when:
  • Domain not found
  • Icon fetch failed
  • Invalid URL

Middleware Pipeline

From src/Icons/Startup.cs:60:
Request Pipeline

Response Headers

Configuration Endpoint

Returns cache configuration:

HTTP Client Configuration

The service uses custom HTTP client configuration:
HTTP Client Setup

Security Features

URL Validation

Validate and sanitize all input URLs

CSP Headers

Content-Security-Policy prevents script execution

CORS Policy

Allow only configured origins

Size Limits

Limit cached icon size to prevent abuse

Performance Optimization

Caching Benefits

  • Reduces external HTTP requests
  • Faster icon loading for users
  • Lower bandwidth usage
  • Improved vault performance

Cache Eviction

Least Recently Used (LRU) eviction when cache is full:

Deployment

Environment Variables

Docker

Kubernetes

Deployment

Monitoring

Metrics to Track

  • Cache hit rate
  • Icon fetch latency
  • Failed fetches
  • Cache size utilization
  • Request rate

Health Check

Troubleshooting

Common Issues

Debug Logging

Self-Hosted Considerations

For air-gapped environments, consider pre-populating cache or disabling icon fetching.

Firewall Requirements

The Icons service needs outbound HTTPS access to:
  • Any website domain users have vault items for
  • Port 443 (HTTPS)
  • Port 80 (HTTP, redirects to HTTPS)