routesvaadinupgradevaadin21

Vaadin (Flow) 21 Upgrade from 20 - All routes suddenly return 404


I recently tried to upgrade from Vaadin 20 to Vaadin 21. I followed the upgrading guide and everything seemed to start nicely without any error messages. But when I try to navigate to any route only my MainLayout is loaded and everything inside loads the not found page (for every route), no error messages in the log. Seems to me like the routes are not properly populated regardless if openly accessible or with login.

Stack:

Header Config of Sample Page:

@CssImport("./styles/page/login.css")
@PageTitle("Login")
@Component
@RouteAlias(value = "", layout = MainLayout.class, absolute = true)
@Route(value = "login", layout = MainLayout.class, absolute = true)
@UIScope
public class LoginView {
   // ...
}

Not found page:

@ParentLayout(MainLayout.class)
@PageTitle("Notfound")
public class CustomRouteNotFoundError extends RouteNotFoundError implements BeforeEnterObserver 

Is there something wrong with my route definition or did something change in the security configuration from Vaadin 20 to 21?


Solution

  • Vaadin 21 blocks access to all views by default. You need to add annotations to each view specifying who should have access. @PermitAll will allow all logged-in users to access the view. See https://vaadin.com/docs/v21/flow/integrations/spring/view-based-access-control/#annotating-the-view-classes