fix(ai): remove Link header from /raw/* and use window.location.origin for raw URLs

- Remove Link header from global headers scope, apply only to /index.html
- Remove X-Robots-Tag noindex from /raw/* to allow AI crawler indexing
- Use window.location.origin instead of props.url for raw markdown URL construction
- Ensures correct URLs even when props.url points to canonical/deploy preview domains
- Fixes ChatGPT/Perplexity fetch failures on /raw/*.md endpoints
This commit is contained in:
Wayne Sutton
2025-12-24 00:13:10 -08:00
parent a9d500ca4f
commit 6ac6098668
3 changed files with 59 additions and 6 deletions

View File

@@ -76,7 +76,7 @@
"/openapi.yaml"
]
# Security and SEO headers
# Security and SEO headers (global, excludes /raw/*)
[[headers]]
for = "/*"
[headers.values]
@@ -84,16 +84,23 @@
X-Content-Type-Options = "nosniff"
X-XSS-Protection = "1; mode=block"
Referrer-Policy = "strict-origin-when-cross-origin"
# Link header removed from global scope to avoid applying to /raw/*
# Link header for SPA entry point only
[[headers]]
for = "/index.html"
[headers.values]
Link = "</llms.txt>; rel=\"author\""
# Raw markdown files - AI friendly headers
# No Link header, no noindex - optimized for AI crawlers
[[headers]]
for = "/raw/*"
[headers.values]
Content-Type = "text/markdown; charset=utf-8"
Access-Control-Allow-Origin = "*"
Cache-Control = "public, max-age=3600"
X-Robots-Tag = "noindex"
# Removed X-Robots-Tag = "noindex" - AI crawlers need to index raw content
[context.production.environment]
NODE_ENV = "production"