#How to add http to https redirect in spring boot web flux (netty server)?

4 messages · Page 1 of 1 (latest)

odd yoke
#

This is from spring docs for redirecting http request to https in netty (webflux). I added this code and it does redirect to https. But when trying to log in (send a post request) from inside frontend, it can not find expected header 'csrf token' (this was working correctly before adding redirect code).

@Bean
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
    http
        // ...
        .redirectToHttps(withDefaults());
    return http.build();
}
white siloBOT
#

This post has been reserved for your question.

Hey @odd yoke! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

blissful sigil
#

You probably triggered CSRF protection. But there's no reason to disable it. Just add the token to your frontend.