Support the ongoing development of Laravel.io →
Session Cache
Last updated 2 years ago.
0

The array doesn't set a cookie because it is only for the 1 page request and is then forgotten about. Redis, file and any other storage that allows the data to be re-loaded on other requests needs a cookie to know how to get the correct user's session.

There needs to be a cookie in order to identify the user.

Last updated 9 years ago.
0

There needs to be a cookie in order to identify the user.

Which makes sense for an authenticated user, not for an anonymous, non logged-in user.

For anonymous users, caching should be on for all elements. So, the question is -- where to deal with that.

Even for authenticated users, there's usually some page element / content that can benefit from caching -- for that ESI+caching comes into play. That's a bit further down the road here ...

0

From my understanding of stripping cookies, PHP (or Laravel) will no longer have access to the cookie, and as such will no longer have access to the Session. So, how do you get around that? Is there a way to make Laravel only set a cookie if the user is logged in?

0

Is there a way to make Laravel only set a cookie if the user is logged in?

yes.

use the "Session Monster" plugin (https://packagist.org/packages/haifanghui/session-monster)

following install & config

http://abeak.blogspot.com/2014/12/caching-laravel-with-varnish.html

does the trick.

varnish 'HITs' if NOT-logged in; cookie is preserved if AUTH'd.

0

not only cookie but also for the remember token

0
illuminate/support: 4.2.*

How about L5 / L5.1 ?

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

grantksup grantksup Joined 16 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.