Package org.springframework.security.web.server.transport

# 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
Constructor
Description
`HttpsRedirectWebFilter()`

## Method Summary

Modifier and Type
Method
Description
`reactor.core.publisher.Mono<Void>`
`filter(org.springframework.web.server.ServerWebExchange exchange, org.springframework.web.server.WebFilterChain chain)`
`void`
`setPortMapper(PortMapper portMapper)`
Use this `PortMapper` for mapping custom ports
`void`
`setRequiresHttpsRedirectMatcher(ServerWebExchangeMatcher requiresHttpsRedirectMatcher)`
Use this `ServerWebExchangeMatcher` to narrow which requests are redirected to HTTPS.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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:
  `filter` in interface `org.springframework.web.server.WebFilter`

### setPortMapper

public void setPortMapper(PortMapper portMapper)
Use this `PortMapper` for mapping custom ports

Parameters:
  `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.

Parameters:
  `requiresHttpsRedirectMatcher` - the `ServerWebExchangeMatcher` to use