fix: root files answer 503 while the backend has not answered

- rootFileTargets gives robots.txt, sitemap.xml and llms.txt their backend
  target also in state unknown without a last answer, so the failing fetch
  answers 503 with Retry-After: 60 instead of the app's 404 (L4 WR-08)
- an older backend (absent) still passes through; sitemap files and
  verification files still need a site answer
- expect-seo-down.txt expects the 503s and states the staging reason
This commit is contained in:
Jakub Zych
2026-11-04 22:49:40 +01:00
parent a651de4675
commit 8cdf35929a
5 changed files with 51 additions and 24 deletions

View File

@@ -7,12 +7,16 @@
// of reading a missing robots.txt as "everything allowed". Any other path
// passes through.
//
// Only once the backend has given its site answer (SEO v0.2.0; the last
// one seen is kept while the backend is down). With a backend before v0.2.0
// (the site answer is 404), or one not reached since the server started,
// nothing is proxied here, as in v0.1.1: robots.txt and the sitemaps stay
// with the site's proxy (or fall through to the app) and verification
// files keep the v0.1.1 lookup (seo-verification.ts). Off with
// Once the backend has given its site answer (SEO v0.2.0; the last one
// seen is kept while the backend is down) every file above is proxied.
// While the backend has not answered since the server started, only
// robots.txt, sitemap.xml and llms.txt are: the failing fetch answers 503
// with Retry-After, so a staging site never exposes the app's 404 as an
// allow-all robots.txt (L4 WR-08). With a backend before v0.2.0 (the site
// answer is 404) nothing is proxied here, as in v0.1.1: robots.txt and the
// sitemaps stay with the site's proxy (or fall through to the app); there
// and while the backend is unknown, verification files keep the v0.1.1
// lookup (seo-verification.ts). Off with
// the module option seo.rootFiles false or the layer switched off. The
// backend URLs come from the server-only bases and an allow-listed name only
// (rootFileTargets), never from the request.