-
I am experiencing intermittent logouts when navigating between different routes (i.e. by clicking links in the navigation bar). On roughly every 2nd to 10th request, it 302s to System information: Symfony version: 6.4.20 (LTS)
PHP: 8.4.3 PHP (fpm)
Apache: 2.4.62
Environment: dev
Debug: enabled
OPcache: enabled
APCu: disabled
Xdebug: enabled
Enabled Bundles:
"Symfony\Bundle\DebugBundle\DebugBundle"
"Doctrine\Bundle\DoctrineBundle\DoctrineBundle"
"Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle"
"Symfony\Bundle\FrameworkBundle\FrameworkBundle"
"Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle"
"Symfony\Bundle\MakerBundle\MakerBundle"
"Symfony\Bundle\MonologBundle\MonologBundle"
"Symfony\UX\React\ReactBundle"
"Symfony\Bundle\SecurityBundle\SecurityBundle"
"Symfony\UX\StimulusBundle\StimulusBundle"
"SymfonyCasts\Bundle\ResetPassword\SymfonyCastsResetPasswordBundle"
"SymfonyCasts\Bundle\VerifyEmail\SymfonyCastsVerifyEmailBundle"
"Symfony\UX\Turbo\TurboBundle"
"Symfony\Bundle\TwigBundle\TwigBundle"
"Twig\Extra\TwigExtraBundle\TwigExtraBundle"
"Symfony\Bundle\WebProfilerBundle\WebProfilerBundle"
"Symfony\WebpackEncoreBundle\WebpackEncoreBundle" Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Chrome's dev tools allowed me to figure this one out by inspecting the JS initiator of requests in the network tab. It turns out that Turbo tries to be smart about prefetching sites when hovering with the mouse over navigation links! So whenever the mouse touched the logout link, the session would be logged out. One can disable it by adding a meta tag: <meta name="turbo-prefetch" content="false"> or data attribute to/around the links: <a href="/logout" data-turbo-prefetch="false">Logout</a>
<div data-turbo-prefetch="false">
<a href="/logout">Logout</a>
</div> |
Beta Was this translation helpful? Give feedback.
Chrome's dev tools allowed me to figure this one out by inspecting the JS initiator of requests in the network tab. It turns out that Turbo tries to be smart about prefetching sites when hovering with the mouse over navigation links! So whenever the mouse touched the logout link, the session would be logged out.
One can disable it by adding a meta tag:
or data attribute to/around the links: