|
@@ -1,5 +1,6 @@
|
|
|
package com.provectus.kafka.ui.config;
|
|
|
|
|
|
+import java.util.Optional;
|
|
|
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.server.ServerWebExchange;
|
|
@@ -22,13 +23,13 @@ public class CustomWebFilter implements WebFilter {
|
|
|
String contextPath = serverProperties.getServlet().getContextPath() != null
|
|
|
? serverProperties.getServlet().getContextPath() : "";
|
|
|
|
|
|
- if (exchange.getRequest().getURI().getPath().equals(contextPath + "/")
|
|
|
- || exchange.getRequest().getURI().getPath().startsWith(contextPath + "/ui")) {
|
|
|
+ final String path = exchange.getRequest().getURI().getPath().replaceAll("/$", "");
|
|
|
+ if (path.equals(contextPath) || path.startsWith(contextPath + "/ui")) {
|
|
|
return chain.filter(
|
|
|
exchange.mutate().request(exchange.getRequest().mutate().path("/index.html").build())
|
|
|
.build()
|
|
|
);
|
|
|
- } else if (exchange.getRequest().getURI().getPath().startsWith(contextPath)) {
|
|
|
+ } else if (path.startsWith(contextPath)) {
|
|
|
return chain.filter(
|
|
|
exchange.mutate().request(exchange.getRequest().mutate().contextPath(contextPath).build())
|
|
|
.build()
|