Spring Security Issue "Server connection lost, trying to reconnect.." with

I have created a vaadin flow application using 14.1.2 version and configured with Keycloak Identity Server.

The Security Configuration is like this

  @Override
  protected void configure(HttpSecurity http) throws Exception {
    super.configure(http);
//    http.authorizeRequests().and().csrf().disable();

    http.httpBasic().disable();
    http.formLogin().disable();
    http.anonymous().disable();
    http.csrf().disable();

    http
            .authorizeRequests()
            .antMatchers("/vaadinServlet/UIDL/**").permitAll()
            .antMatchers("/vaadinServlet/HEARTBEAT/**").permitAll()
            .anyRequest().authenticated()
            .requestMatchers(SecurityUtils::isFrameworkInternalRequest).permitAll();
    http
            .logout()
            .addLogoutHandler(keycloakLogoutHandler())
            .logoutUrl("/sso/logout").permitAll()
            .logoutSuccessUrl("/");
    http
            .addFilterBefore(keycloakPreAuthActionsFilter(), LogoutFilter.class);
    http
            .exceptionHandling()
            .authenticationEntryPoint(authenticationEntryPoint());
    http
            .sessionManagement()
            .sessionAuthenticationStrategy(sessionAuthenticationStrategy());
  }

All are working correctly until the keycloak session expires. Then I get a notification “Server connection lost, trying to reconnect” and only if I press refresh in browser I am being forwared to login page of keycloak.
Any idea how to configure properly?

Hi Kostas,
I use the same combination like you (Vaadin 14.4.4 with keycloak as Identity Server) but I’m new to this.
After I could successfully log-in and then the keycloak session expired I faced the same issue like you. Did you find a solution for this in the meantime?

And how do you do a logout? I can’t find any example and I cannot get it to work. After I logout, my user still is authenticated also if I reoload the browser.

Thank you for your feedback.