Skip to content

Commit

Permalink
fix (webserver): add redirect from root path to context-path (tchiotl…
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrp authored Mar 25, 2021
1 parent 4de7a24 commit 57c11bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ services:
working_dir: /app
volumes:
- ./:/app:z
- /app/.gradle:Z
- ./gradle/gradle.properties:/root/.gradle/gradle.properties:Z
ports:
- 8080:8080
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/org/akhq/controllers/ErrorController.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.akhq.controllers;

import io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException;
import io.micrometer.core.instrument.util.StringUtils;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.HttpStatus;
Expand Down Expand Up @@ -96,7 +97,11 @@ public HttpResponse<?> error(HttpRequest<?> request, Throwable e) {
}

@Error(status = HttpStatus.NOT_FOUND, global = true)
public HttpResponse<?> notFound(HttpRequest<?> request) {
public HttpResponse<?> notFound(HttpRequest<?> request) throws URISyntaxException {
if (request.getPath().equals("/") && StringUtils.isNotEmpty(getBasePath())) {
return HttpResponse.temporaryRedirect(this.uri("/"));
}

JsonError error = new JsonError("Page Not Found")
.link(Link.SELF, Link.of(request.getUri()));

Expand Down

0 comments on commit 57c11bd

Please sign in to comment.