Skip to content

Commit fa61749

Browse files
committed
fix: add favicon support in PostHog proxy and update Docusaurus config
1 parent 33edd24 commit fa61749

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

site/docusaurus.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ const config: Config = {
3030
clientModules: [require.resolve('./src/clientModules/webmcp.ts')],
3131

3232
headTags: [
33+
{
34+
tagName: 'link',
35+
attributes: {
36+
rel: 'icon',
37+
type: 'image/x-icon',
38+
href: '/favicon.ico',
39+
},
40+
},
3341
{
3442
tagName: 'script',
3543
attributes: {},

workers/posthog-proxy/src/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ export default {
55
async fetch(request: Request): Promise<Response> {
66
const url = new URL(request.url);
77

8+
// Serve the existing SVG favicon at /favicon.ico so browsers that
9+
// request the default path get a valid icon. Cache-Control overrides the
10+
// 10-minute GitHub Pages default so Cloudflare caches it efficiently.
11+
if (url.pathname === '/favicon.ico') {
12+
const svgUrl = new URL('/img/favicon.svg', url);
13+
const response = await fetch(svgUrl.toString());
14+
const headers = new Headers(response.headers);
15+
headers.set('Content-Type', 'image/svg+xml');
16+
headers.set('Cache-Control', 'public, max-age=86400, stale-while-revalidate=604800');
17+
return new Response(response.body, { status: response.status, headers });
18+
}
19+
820
// Strip the /ingest prefix
921
const path = url.pathname.replace(/^\/ingest/, '') || '/';
1022

workers/posthog-proxy/wrangler.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ compatibility_date = "2024-01-01"
44

55
routes = [
66
{ pattern = "raidcli.dev/ingest/*", zone_name = "raidcli.dev" },
7+
{ pattern = "raidcli.dev/favicon.ico", zone_name = "raidcli.dev" },
78
]

0 commit comments

Comments
 (0)