Skip to content

feat(reroute): Allow for dynamic asynchronously rerouting #13176

@nikosgram

Description

@nikosgram

Describe the problem

The current SvelteKit Reroute functionality doesn't support dynamic rerouting for localization where settings are stored in a database. We need to implement a multi-domain, multi-prefix localization system that allows flexible domain/language combinations.

Example configuration:

  • Domains: example.com, example.uk, example.gr, example.fr
  • Localizations: en-gb, el-gr, en-gr, fr-fr, en-fr

Domain/prefix mappings:

el-gr:
- example.com/el-gr/
- example.gr/

en-gr:
- example.com/en-gr/
- example.gr/en/

en-gb:
- example.com/
- example.uk/

Describe the proposed solution

Modify the Reroute function to return MaybePromise<void | string> and update its implementation in server/response.js and client/client.js.

A proof-of-concept implementation: nikosgram@70d808e

I would appreciate feedback on this approach to ensure I'm not overlooking any potential issues or better alternatives.

Alternatives considered

No response

Importance

i cannot use SvelteKit without it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions