spring-framework / org.springframework.web.filter / RelativeRedirectFilter

RelativeRedirectFilter

open class RelativeRedirectFilter : OncePerRequestFilter

Overrides HttpServletResponse#sendRedirect(String) and handles it by setting the HTTP status and "Location" headers. This keeps the Servlet container from re-writing relative redirect URLs and instead follows the recommendation in RFC 7231 Section 7.1.2.

Note: While relative redirects are more efficient they may not work with reverse proxies under some configurations.

Author
Rob Winch

Author
Rossen Stoyanchev

Since
4.3.10

Constructors

<init>

RelativeRedirectFilter()

Overrides HttpServletResponse#sendRedirect(String) and handles it by setting the HTTP status and "Location" headers. This keeps the Servlet container from re-writing relative redirect URLs and instead follows the recommendation in RFC 7231 Section 7.1.2.

Note: While relative redirects are more efficient they may not work with reverse proxies under some configurations.

Functions

getRedirectStatus

open fun getRedirectStatus(): HttpStatus

Return the configured redirect status.

setRedirectStatus

open fun setRedirectStatus(status: HttpStatus): Unit

Set the default HTTP Status to use for redirects.

By default this is HttpStatus#SEE_OTHER.