Skip to content

Commit 0be9172

Browse files
fix(darren): serve real robots.txt instead of 302-to-apex fallback
spivanatalie64/darren gh-pages has no robots.txt, so the worker's not-found fallback 302'd crawlers to https://acreetionos.org/ with the path dropped — GSC saw a redirect, not a valid per-host robots.txt. - special-case /robots.txt: answer 200 text/plain directly - extMap += .txt/.xml so repo-side text files get correct content types
1 parent 6fdf2b3 commit 0be9172

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,6 +2163,19 @@ export default {
21632163
if (url.hostname === 'darren.acreetionos.org') {
21642164
if (url.pathname.startsWith('/api/')) {
21652165
// Pass through to normal routing
2166+
} else if (url.pathname === '/robots.txt') {
2167+
// GSC fix (2026-08-21): spivanatalie64/darren gh-pages has no
2168+
// robots.txt, so the not-found fallback at the bottom of this block
2169+
// used to 302 crawlers to https://acreetionos.org/ (path dropped) —
2170+
// GSC reported a redirect instead of a valid per-host robots.txt.
2171+
// Serve one directly; keep it in sync with natalie-robots policy.
2172+
return new Response('# darren.acreetionos.org\nUser-agent: *\nAllow: /\n', {
2173+
status: 200,
2174+
headers: {
2175+
'Content-Type': 'text/plain; charset=utf-8',
2176+
'Cache-Control': 'public, max-age=3600',
2177+
},
2178+
});
21662179
} else {
21672180
const RAW_BASE = 'https://raw.githubusercontent.com/spivanatalie64/darren/gh-pages';
21682181
let rawPath = url.pathname;
@@ -2187,6 +2200,8 @@ export default {
21872200
'.svg': 'image/svg+xml',
21882201
'.webp': 'image/webp',
21892202
'.ico': 'image/x-icon',
2203+
'.txt': 'text/plain; charset=utf-8',
2204+
'.xml': 'application/xml; charset=utf-8',
21902205
};
21912206
const ext = Object.keys(extMap).find(e => rawUrl.endsWith(e)) || '';
21922207
const contentType = ext ? extMap[ext] : 'application/octet-stream';

0 commit comments

Comments
 (0)