How to reset or close a Vaadin 14.2 session properly

After a logout, I need to redirect my users back to the login page. But I need to clear out the session so that a new user can login. In 14 compatibility mode I used to call UI.getCurrent().getSession().close() in beforeEnter() and then redirect to the login page.

This worked fine until I ported to 14.2. Now if I call UI.getCurrent().getSession().close() the forward to / redirect to doesn’t work anymore, I get an endless display loop on the logout page.

Is there an official correct way to close a Vaadin 14.2 session?

Had the same issue. Change this to getUI().get().getSession().close() and this fixed the issue for me.