diff --git a/spring-web/src/main/java/org/springframework/web/filter/reactive/ForwardedHeaderFilter.java b/spring-web/src/main/java/org/springframework/web/filter/reactive/ForwardedHeaderFilter.java
index 4c65121bbb..43c8b32f76 100644
--- a/spring-web/src/main/java/org/springframework/web/filter/reactive/ForwardedHeaderFilter.java
+++ b/spring-web/src/main/java/org/springframework/web/filter/reactive/ForwardedHeaderFilter.java
@@ -39,6 +39,7 @@ import org.springframework.web.util.UriComponentsBuilder;
* where "Forwarded" and "X-Forwarded-*" headers are eliminated, and not used.
*
* @author Arjen Poutsma
+ * @author Rossen Stoyanchev
* @since 5.0
* @see https://tools.ietf.org/html/rfc7239
*/
@@ -71,7 +72,6 @@ public class ForwardedHeaderFilter implements WebFilter {
@Override
public Mono filter(ServerWebExchange exchange, WebFilterChain chain) {
-
ServerHttpRequest request = exchange.getRequest();
if (!hasForwardedHeaders(request)) {
return chain.filter(exchange);
@@ -117,8 +117,8 @@ public class ForwardedHeaderFilter implements WebFilter {
int endIndex = prefix.length();
while (endIndex > 1 && prefix.charAt(endIndex - 1) == '/') {
endIndex--;
- };
- prefix = endIndex != prefix.length() ? prefix.substring(0, endIndex) : prefix;
+ }
+ prefix = (endIndex != prefix.length() ? prefix.substring(0, endIndex) : prefix);
}
return prefix;
}