fix(frontend): disable prerender crawl so /, /documents, /persons aren't baked
Some checks failed
CI / fail2ban Regex (push) Has been cancelled
CI / Compose Bucket Idempotency (push) Has been cancelled
CI / Unit & Component Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Failing after 2m49s
CI / OCR Service Tests (pull_request) Successful in 15s
CI / Compose Bucket Idempotency (pull_request) Successful in 56s
CI / OCR Service Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / Backend Unit Tests (pull_request) Successful in 4m9s
CI / fail2ban Regex (pull_request) Successful in 37s

Closes #514.

The build was prerendering protected routes via crawl from
/hilfe/transkription. Their load functions throw redirect('/login')
during the build (no auth cookie), so SvelteKit captured the redirect
as static HTML and shipped /app/build/prerendered/{index,documents,
persons,geschichten,stammbaum}.html with a `location.href=/login`
script. In production these files are served BEFORE hooks.server.ts
runs, so an authenticated user with a valid cookie is still served
the baked bounce-back page.

Setting `crawl: false` keeps the explicit /hilfe/transkription entry
prerendered (needed for the public help page) without dragging the
nav targets along with it.

Verified locally: build now emits only `hilfe/transkription.html`
under build/prerendered/, no index.html or documents.html etc.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-11 16:52:42 +02:00
parent 54a8f7f8e9
commit 0da768f3a4

View File

@@ -8,7 +8,17 @@ const config = {
preprocess: vitePreprocess(),
kit: {
adapter: adapter(),
prerender: { entries: ['/hilfe/transkription'] }
prerender: {
entries: ['/hilfe/transkription'],
// Disable crawl: by default SvelteKit follows nav links from
// prerendered pages and prerenders the targets too. The targets
// (/, /documents, /persons, …) throw redirect('/login') during
// the build (no auth cookie), so SvelteKit bakes a
// `<script>location.href='/login'</script>` HTML page and serves
// it before the runtime hooks ever run. Result: authenticated
// users with a valid cookie still get bounced. See #514.
crawl: false
}
}
};