I'm developing two separate projects: one is Polymer
app with Service worker
(scaffolded with Polymer CLI) and second app is Spring Boot
with Vaadin
and its itegration library Vaadin Spring
. Both applications are running on localhost:8080
.
On SpringBoot app, non-authenticated user is redirected to /login
. After successful authentication user should be redirected back to /
, but instead is redirected to url http://localhost:8080/service-worker.js
, where is displayed default spring 404
page. When I manually change url back to /
, SpringBoot app is working again.
I can't find source of the problem (if is it Polymer or SpringBoot+Vaadin) and clearing cache or manually changing URL every time is frustrating.
EDIT:
I'm using default handler SavedRequestAwareVaadinAuthenticationSuccessHandler
provided by Vaadin Spring
. It should redirect back to previous URL or to fallback URL /
.
@Bean(name = VaadinSharedSecurityConfiguration.VAADIN_AUTHENTICATION_SUCCESS_HANDLER_BEAN)
VaadinAuthenticationSuccessHandler vaadinAuthenticationSuccessHandler(@SuppressWarnings("SpringJavaAutowiringInspection") HttpService httpService, VaadinRedirectStrategy vaadinRedirectStrategy) {
return new SavedRequestAwareVaadinAuthenticationSuccessHandler(httpService, vaadinRedirectStrategy, "/");
}
I Soleved it. Go to locahost:8080/login -> Inspect (ctr+shift+I) -> Application tab -> choose Service Worker and unregister sw.js Good luck!
I had the same problem. This is a browser thing, and you can't do noting from your application or on server side.
I solved ti by deleting service worker for localhost adress in chrome manually.
You can do it by opening developer tools in chrome -> Tab Resources -> Service Workers
Find your service worker on specific url, for example http://localhost:8080/login and delete it.
Another alternative is to use different localhost (localhost, 127.0.0.1, 127.0.0.2) IP addresses for developing polymer application and Vaadin application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With