From 9744dc7f24d86c10c6e8c6ff3ad54976cb9abe80 Mon Sep 17 00:00:00 2001 From: loki5512344 Date: Wed, 30 Sep 2026 15:40:04 +0200 Subject: [PATCH] fix(frontend): add a real robots.txt, cache hashed assets forever Lighthouse audit findings: - No robots.txt existed, so nginx's SPA fallback (try_files -> index.html) served the React app's HTML at /robots.txt -- crawlers got 44 "syntax not understood" lines instead of directives. - No Cache-Control on /assets/*, so every visit re-fetched a hashed, content-addressed bundle that can never actually change under that URL. Lighthouse estimated 936 KiB/visit wasted on this alone. Claude-Session: https://claude.ai/code/session_01F1M1Jic1wTSn4igUENynmZ --- backend/deploy/nginx-visual.loki-code.dev.conf | 8 ++++++++ frontend/public/robots.txt | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 frontend/public/robots.txt diff --git a/backend/deploy/nginx-visual.loki-code.dev.conf b/backend/deploy/nginx-visual.loki-code.dev.conf index 66341f5..bd5384b 100644 --- a/backend/deploy/nginx-visual.loki-code.dev.conf +++ b/backend/deploy/nginx-visual.loki-code.dev.conf @@ -16,6 +16,14 @@ server { proxy_cookie_path /auth /api/auth; } + # Fingerprinted build output (assets/-.js/.css/...) -- the filename changes + # whenever the content does, so it's safe to cache "forever"; a stale copy is never served + # under the old URL after a deploy. + location /assets/ { + add_header Cache-Control "public, max-age=31536000, immutable" always; + try_files $uri =404; + } + location / { try_files $uri /index.html; } diff --git a/frontend/public/robots.txt b/frontend/public/robots.txt new file mode 100644 index 0000000..c2a49f4 --- /dev/null +++ b/frontend/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Allow: /