Created
April 20, 2020 13:40
-
-
Save SergeyAlekseevN/415dca21d8b8f630db27dee29bef2036 to your computer and use it in GitHub Desktop.
CustomWebFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** | |
* Workaround of https://github.com/spring-projects/spring-boot/issues/9785 from https://stackoverflow.com/a/45190717/1477873 | |
* | |
* @author Sergey Alekseev | |
*/ | |
@Component | |
public class CustomWebFilter implements WebFilter { | |
@NotNull | |
@Override | |
public Mono<Void> filter(ServerWebExchange exchange, @NotNull WebFilterChain chain) { | |
if (exchange.getRequest().getURI().getPath().equals("/")) { | |
return chain.filter(exchange.mutate().request(exchange.getRequest().mutate().path("/index.html").build()).build()); | |
} | |
return chain.filter(exchange); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment