-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to handle routes for base URI without path from extensions #42840
Labels
Milestone
Comments
This is the code deciding where to mount the route: if (route.startsWith(buildItem.getRootPath())) {
// relative to http root (leading slash for vert.x route)
this.path = "/" + UriNormalizationUtil.relativize(buildItem.getRootPath(), route);
this.routerType = RouteType.APPLICATION_ROUTE;
} else if (route.startsWith("/")) {
// absolute path
this.path = route;
this.routerType = RouteType.ABSOLUTE_ROUTE;
} I don't see why your route would be mounted on the application router and not as an absolute route. |
@cescoffier The problem is in URI normalization in
Leading to the normalizeWithBase() method. When considering
|
@cescoffier Might this be considered as a fix? |
cescoffier
changed the title
[Vert.X] Possible to handle routes for base URI without path from extensions
Possible to handle routes for base URI without path from extensions
Aug 30, 2024
gsmet
pushed a commit
to gsmet/quarkus
that referenced
this issue
Sep 2, 2024
…ensions Closes quarkusio#42840 Signed-off-by: Martin Bartoš <mabartos@redhat.com> (cherry picked from commit c4beb8c)
gsmet
pushed a commit
to gsmet/quarkus
that referenced
this issue
Sep 3, 2024
…ensions Closes quarkusio#42840 Signed-off-by: Martin Bartoš <mabartos@redhat.com> (cherry picked from commit c4beb8c)
danielsoro
pushed a commit
to danielsoro/quarkus
that referenced
this issue
Sep 20, 2024
…ensions Closes quarkusio#42840 Signed-off-by: Martin Bartoš <mabartos@redhat.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
In our custom extension (Keycloak), I've encountered the impossibility of defining
RouteBuildItem
for the base URI without path when the root-path (quarkus.http.root-path
) is different than "/".The thing is that I want to automatically redirect from the base URI to the root-path endpoint.
The case:
quarkus.http.root-path=/auth
=> our app is accessible onlocalhost:8080/auth
When I access
localhost:8080
, I want to be redirected to thelocalhost:8080/auth
.I tried to build my own
RouteBuildItem
with theHttpRootPathBuildItem
, but I'm not able to do it for the base URI, when the root-path is specified.See this code (pseudo):
But it is not possible to do it with a specified
route("/")
as an absolute path - it's evaluated as relative path to the root-path. When I change the route to something else (route("/something"
) and then access it, everything works as expected.Or is there any other approach how to achieve it?
Implementation ideas
Consider
.route("/")
as an absolute path unrelated toquarkus.http.root-path
. Or is it problematic in some cases?The text was updated successfully, but these errors were encountered: