When using htmx with Spring Boot and Thymeleaf, AJAX requests can silently fail on authentication errors since there are no full page refreshes. The solution is a custom AuthenticationEntryPoint implementation called HxRefreshHeaderAuthenticationEntryPoint that adds the HX-Refresh: true response header when an unauthenticated request is detected, causing htmx to trigger a full page reload so the user is redirected to the login page properly.
Sort: