flow: Enabling Push causes reload loop
Description of the bug
When I add @Push to my AppShellConfigurator and visit the application website it loads the page but as soon as it is done it starts over and reloads the whole page again and again.
This results in a reload loop that seems to stop after a random amount of iterations. Sometimes it stops after 5 to 10 reloads, and sometimes it seems to not stop at all.
Some things I noticed:
- it works fine when run locally
- it occurs only on one of our two environments (but the hosting infrastructure is identical)
- it does not matter which push mode is used
- it does not matter which route is visited
- it does not matter if push is actually triggered; enabling it is enough to break it, even on an empty page
- we do not use jetty (I read about issues with Push in combination with jetty)
Expected behavior
The website should load only once.
Or maybe you have an idea on what could cause such a behavior on our side, so we can investigate further.
Minimal reproducible example
I cannot deliver much here, sorry. That’s because it only occurs on one of our deployed stages and I cannot reproduce it anywhere else. But I tested different applications on that environment and they all show the same issue.
The only thing that I need to add to one of our applications is this (kotlin):
@Push // <-- this
class AppShell : AppShellConfigurator
That’s it.
These are some recordings I made of how the issue looks like:
-
The following shows the issue on an almost empty website with Chrome’s network traffic open. You can see that the page makes a few requests and then starts over. The gif itself is looping of course, but it shows like 8 reloads before the gif loop ends.
-
When I pause the reload and have a look at the last request (before everything starts over), I can see that it is a query of the original website. So it is basically identical to the first request made when I enter the URL in the browser. Just that this time it originates from Vaadin itself, more precisely from
vaadinPush-min.js(see on the right). Looks like this is causing the page reload.
Any hints on how to address this are welcome.
Versions
- Vaadin / Flow version: 23.3.15
- Java version: 11
- OS version: Amazon Linux
- Browser version: Chrome 114 ARM (currently latest)
- Application Server: Spring Boot / Tomcat
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15
I did some tests with our Spring Security configuration and it seems to be resolved now.
Changing
to
made it work.
The server logs also show that after this change the
JSESSIONIDcookie has the same value for every request.It is still unclear though why this was not an issue on our other hosting environment which uses the same security configuration.
Thank you @mcollovati for your help figuring this out!