Summary

Currently we have the ability to store a user's initial request using WebSessionServerRequestCache. This causes the WebSession to be read on every request. We should provide an alternative that stores the initial request in a cookie instead of in the WebSession.

Comment From: eleftherias

To use the CookieServerRequestCache, you can specify it in your security configuration.

@Bean
SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) {
    return http
        .authorizeExchange(exchanges -> exchanges
            .anyExchange().authenticated()
        )
        .formLogin(withDefaults())
        .requestCache(cache -> cache
            .requestCache(new CookieServerRequestCache())
        )
        .build();
}