fix: harden admin page cache headers

This commit is contained in:
ik
2026-09-16 19:57:05 +07:00
parent eb4d6ccdb0
commit d9f58fb90e
2 changed files with 10 additions and 1 deletions
+6 -1
View File
@@ -32,7 +32,12 @@ const theme = storedTheme === "light" || storedTheme === "dark" ? storedTheme :
const siteUrl = import.meta.env.PUBLIC_SITE_URL || "https://rf4spotter.ru";
const canonical = new URL(path, siteUrl).toString();
const socialImage = new URL(image, siteUrl).toString();
const preventIndexing = noindex || path === "/admin" || path.startsWith("/admin/");
const isAdminPath = path === "/admin" || path.startsWith("/admin/");
const preventIndexing = noindex || isAdminPath;
if (isAdminPath) {
Astro.response.headers.set("Cache-Control", "private, no-store");
Astro.response.headers.set("X-Robots-Tag", "noindex, nofollow");
}
const websiteJsonLd = { "@type": "WebSite", name: "RF4 Spotter", url: siteUrl, inLanguage: "ru" };
// A08: Skip structuredData on error pages (explicit errorPage prop)
// Don't infer error from noindex alone — main page can have noindex on 422