Skip to content

fix: let same-origin /ory redirects leave the SvelteKit router so landing-page Register and Login reach Kratos (ADR-001072) - #447

Merged
Kaikei-e merged 2 commits into
mainfrom
fix/frontend-kratos-native-navigation
Dec 4, 2026
Merged

Kaikei-e merged 2 commits into
mainfrom
fix/frontend-kratos-native-navigation

Conversation

@Kaikei-e

@Kaikei-e Kaikei-e commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Summary

On a clean-host quickstart, clicking Register on the landing page ended on an error page at /ory/self-service/registration/browser. Login fails the same way.

  • Cause:
    1. The /register and /auth/login server loads redirect to ${KRATOS_PUBLIC_URL}/self-service/.... That URL is same-origin (/ory behind the edge proxy).
    2. SvelteKit's client router follows a same-origin redirect as an in-app navigation whenever a route matches.
    3. The root catch-all src/routes/[...path] matched /ory/..., so the client fetched /ory/self-service/registration/browser/__data.json. Kratos answered 404.
  • Evidence: the edge access log showed /register/__data.json 200, then /ory/.../__data.json 404 twice.
  • Production: the same path exists there. It stays hidden only because registration is closed.

Fix (ADR-001072):

  • The catch-all becomes src/routes/[...path=frontendPath].

    • The frontendPath param matcher (src/params/, SvelteKit 3 defineParams) rejects the prefixes that plecto/manifest.toml routes away from the frontend: ory, api/v1/sse, v1/images/proxy.
    • With no route matching, SvelteKit falls back to a full page load, which reaches Kratos.
  • frontendPath.manifest.test.ts reads plecto/manifest.toml and checks both directions:

    • every non-frontend route is rejected by the matcher;
    • every excluded prefix still exists in the manifest.

    Adding a non-frontend edge route without updating the matcher now fails the unit tests.

  • alt-frontend-sv-unit-test.yaml runs on plecto/manifest.toml changes and sparse-checks out plecto.

Test plan

  • RED commit first:
    • The new matcher and drift tests fail without the implementation.
    • The two new Playwright tests fail on origin/main with the URL stuck at /ory/self-service/{registration,login}/browser.
    • Removing v1/images/proxy from the list fails the drift test, naming plecto/manifest.toml:182.
  • bun run test: 211 files, 2091 passed.
  • bun run check: 0 errors, 0 warnings.
  • bun run build
  • ./scripts/lint/run.sh alt-frontend-sv, ./scripts/lint/run.sh repo (actionlint included).
  • alt-harness frontend-e2e run: 6 affected specs passed, auth and desktop-chromium projects.
    • login, register, route-guard, error-pages, legacy-redirects, sidebar
  • docdag validate --immutable-since origin/main, alt-harness adr-gate --base origin/main

🤖 Generated with Claude Code

Kaikei-e and others added 2 commits December 5, 2026 00:58
…outes, so landing-page Register and Login reach Kratos by a full page load, and that the excluded prefixes match the non-frontend routes in plecto/manifest.toml (ADR-001072)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…matcher that excludes the edge's non-frontend prefixes, so a redirect to same-origin /ory no longer fetches a Kratos __data.json that returns 404, and run the frontend unit tests when plecto/manifest.toml changes (ADR-001072)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Kaikei-e
Kaikei-e merged commit 1040f76 into main Dec 4, 2026
16 checks passed
@Kaikei-e
Kaikei-e deleted the fix/frontend-kratos-native-navigation branch December 4, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant