Skip to content

Inconsistent rootPath Handling in API Routes (Some Endpoints Ignore the Prefix) #561

@NathaelB

Description

@NathaelB

FerrisKey allows configuring a rootPath (e.g., /api) so the entire API can be exposed behind a prefix.
However, several routes are not applying the rootPath, leading to inconsistent behavior and 404 errors in production.

Example of routes missing the prefix:

.route(
    "/realms/{realm_name}/users/{user_id}/roles",
    get(get_user_roles),
)
.route(
    "/realms/{realm_name}/users/{user_id}/credentials",
    get(get_user_credentials),
)

Whereas otehr routes correctly include the prefix:

.route(
    &format!(
        "{}/realms/{{realm_name}}/users/{{user_id}}",
        state.args.server.root_path
    ),
    get(get_user),
)

Impact

When FerrisKey is deployed behind an API Gateway or Ingress using a subpath—e.g.:

Base path: https://ferriskey.bonnal.cloud/api

rootPath = /api

Routes that do not include the rootPath are unreachable and return 404

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions