Class HttpsRedirectWebFilter

  • All Implemented Interfaces:

    public final class HttpsRedirectWebFilter
    extends java.lang.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.
    • Constructor Detail

      • HttpsRedirectWebFilter

        public HttpsRedirectWebFilter()
    • Method Detail

      • filter

        public reactor.core.publisher.Mono<java.lang.Void> filter​(org.springframework.web.server.ServerWebExchange exchange,
                                                                  org.springframework.web.server.WebFilterChain chain)
        Specified by:
        filter in interface org.springframework.web.server.WebFilter
      • setPortMapper

        public void setPortMapper​(PortMapper portMapper)
        Use this PortMapper for mapping custom ports
        portMapper - the PortMapper to use
      • setRequiresHttpsRedirectMatcher

        public void setRequiresHttpsRedirectMatcher​(ServerWebExchangeMatcher requiresHttpsRedirectMatcher)
        Use this ServerWebExchangeMatcher to 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.
        requiresHttpsRedirectMatcher - the ServerWebExchangeMatcher to use