From 4d90ac7eb85aabbc6fe2319f2ee675fdbf16dfc4 Mon Sep 17 00:00:00 2001 From: ai-bot Date: Fri, 16 Oct 2026 17:18:07 +0000 Subject: [PATCH] Serve robots.txt and send X-Robots-Tag on every answer (32.7 point 6) --- app.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.py b/app.py index e9912af..22be396 100644 --- a/app.py +++ b/app.py @@ -86,6 +86,7 @@ STATIC_FILES = { "/icon.svg": ("icon.svg", "image/svg+xml"), "/icon-192.png": ("icon-192.png", "image/png"), "/icon-512.png": ("icon-512.png", "image/png"), + "/robots.txt": ("robots.txt", "text/plain; charset=utf-8"), } # The five application pages are served only to a signed-in user, and every API # endpoint answers 401 without one. ``GET /health``, the login page, the two @@ -1074,6 +1075,10 @@ class AppHandler(BaseHTTPRequestHandler): self.send_header("X-Content-Type-Options", "nosniff") self.send_header("Content-Security-Policy", "default-src 'self'; style-src 'self'; script-src 'self'; frame-ancestors 'none'") self.send_header("Referrer-Policy", "no-referrer") + # Every answer is asked not to be indexed or followed: the pages, the + # JSON, a redirect, the CSV and the static files all go through here, so + # one header covers them all (section 32.7 point 6). + self.send_header("X-Robots-Tag", "noindex, nofollow") def main():