Class HttpsRedirectWebFilter
java.lang.Object
org.springframework.security.web.server.transport.HttpsRedirectWebFilter
- All Implemented Interfaces:
org.springframework.web.server.WebFilter
public final class HttpsRedirectWebFilter
extends Object
implements org.springframework.web.server.WebFilter
Redirects any non-HTTPS request to its HTTPS equivalent.
Can be configured to use a
ServerWebExchangeMatcher to narrow which requests
get redirected.
Can also be configured for custom ports using PortMapper.- Since:
- 5.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>filter(org.springframework.web.server.ServerWebExchange exchange, org.springframework.web.server.WebFilterChain chain) voidsetPortMapper(PortMapper portMapper) Use thisPortMapperfor mapping custom portsvoidsetRequiresHttpsRedirectMatcher(ServerWebExchangeMatcher requiresHttpsRedirectMatcher) Use thisServerWebExchangeMatcherto narrow which requests are redirected to HTTPS.
-
Constructor Details
-
HttpsRedirectWebFilter
public HttpsRedirectWebFilter()
-
-
Method Details
-
filter
public reactor.core.publisher.Mono<Void> filter(org.springframework.web.server.ServerWebExchange exchange, org.springframework.web.server.WebFilterChain chain) - Specified by:
filterin interfaceorg.springframework.web.server.WebFilter
-
setPortMapper
Use thisPortMapperfor mapping custom ports- Parameters:
portMapper- thePortMapperto use
-
setRequiresHttpsRedirectMatcher
Use thisServerWebExchangeMatcherto narrow which requests are redirected to HTTPS. The filter already first checks for HTTPS in the uri scheme, so it is not necessary to include that check in this matcher.- Parameters:
requiresHttpsRedirectMatcher- theServerWebExchangeMatcherto use
-