···11+# favicon.blueat.net
22+33+A small [Cloudflare Worker](https://developers.cloudflare.com/workers/) that fetches a website’s favicon by domain, caches responses at the edge, and returns the image (or a redirect fallback).
44+55+## Quick start
66+77+```bash
88+npm install
99+npm run dev
1010+```
1111+1212+Open `http://localhost:8787/example.com` while `dev` is running.
1313+1414+Deploy:
1515+1616+```bash
1717+npx wrangler login # once per machine
1818+npm run deploy
1919+```
2020+2121+Edit `wrangler.toml` and set `name` to the Worker name you want in Cloudflare.
2222+2323+## Usage
2424+2525+Request path is the domain (no protocol):
2626+2727+| URL | Meaning |
2828+|-----|--------|
2929+| `/{domain}` | Resolve favicon for `domain` |
3030+3131+**Query parameters**
3232+3333+| Param | Effect |
3434+|--------|--------|
3535+| `larger=true` | Prefer larger icons (e.g. Google s2 at 128px, SVG, or big apple-touch sizes from HTML) |
3636+| `default-avatar=<url>` | If no favicon is found, `302` redirect to this URL |
3737+| `throw-error-on-404=true` | If no favicon is found, return `404` instead of redirecting |
3838+3939+Successful responses include `Cache-Control`, `Access-Control-Allow-Origin: *`, and `X-Favicon-Source` describing where the icon came from.
4040+4141+## How it works
4242+4343+1. Check the Workers cache for this domain (and `larger` flag).
4444+2. If `larger`, try Google’s favicon service at 128px.
4545+3. Otherwise fetch the site HTML and parse `<link rel="icon">` / apple-touch-icon tags.
4646+4. Fall back to `/favicon.ico`, then Google’s 32px favicon.
4747+5. If nothing works, redirect to a default image or your `default-avatar`, or `404` when requested.
4848+4949+## Files
5050+5151+- `worker.js` — Worker entrypoint
5252+- `wrangler.toml` — Wrangler project config
5353+5454+## License
5555+5656+Use and modify as you like for your own deployment.