Skip to content

Commit cfb588b

Browse files
committed
Fix #36593: use context-path in Grafana redirect
1 parent a3007f8 commit cfb588b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/java/eu/openanalytics/shinyproxy/monitoring/MonitoringController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.springframework.http.HttpStatus;
3333
import org.springframework.stereotype.Controller;
3434
import org.springframework.web.bind.annotation.RequestMapping;
35+
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
3536
import org.springframework.web.util.UrlPathHelper;
3637

3738
import java.io.IOException;
@@ -61,11 +62,11 @@ public void grafana(HttpServletRequest request, HttpServletResponse response) th
6162
}
6263
String uri = urlPathHelper.getPathWithinApplication(request);
6364
if (uri.equals("/grafana")) {
64-
response.sendRedirect("/grafana/");
65+
response.sendRedirect(ServletUriComponentsBuilder.fromCurrentContextPath().path("/grafana/").build().toUriString());
6566
return;
6667
}
6768
if (!uri.startsWith("/grafana/")) {
68-
throw new IllegalStateException("TODO");
69+
throw new IllegalStateException("Invalid Grafana URL");
6970
}
7071

7172
String target = uri.replace("/grafana/", "/grafana_internal/");

0 commit comments

Comments
 (0)