You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within the view template of my application, I have a notification bar that shows a status message if one is present in the session, e.g. for some non-existing values in route parameters I redirect the user to the home page with some message indicating failure. However, given that I have a HTTP caching header active on my home page route, this means that it is possible that:
users are not shown the warning message due to using a cached version
users are shown the warning message on subsequent visits of the home page, until the cache expires (i.e. browser retries)
Albeit a possibly questionable approach in handling things (an error page rather than a redirect might be more suitable), I was wondering if I could alter the SetCacheHeaders in such a manner that I would skip setting cache headers on any request which has flashed data. However, after a small search I got kind of stuck on how to neatly detect flash content being present, only finding a reference in the Store class, but not being able to find how this content is used elsewhere.
Therefore a few questions:
Is there a neater way than $request->session()->get('_flash.old', []) to determine if the request has flashed session data?
Can anyone elaborate on how this flashed data is extracted somehow? I can't see to find any methods within Store or elsewhere accessing the data.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Within the view template of my application, I have a notification bar that shows a status message if one is present in the session, e.g. for some non-existing values in route parameters I redirect the user to the home page with some message indicating failure. However, given that I have a HTTP caching header active on my home page route, this means that it is possible that:
Albeit a possibly questionable approach in handling things (an error page rather than a redirect might be more suitable), I was wondering if I could alter the
SetCacheHeaders
in such a manner that I would skip setting cache headers on any request which has flashed data. However, after a small search I got kind of stuck on how to neatly detect flash content being present, only finding a reference in theStore
class, but not being able to find how this content is used elsewhere.Therefore a few questions:
$request->session()->get('_flash.old', [])
to determine if the request has flashed session data?Store
or elsewhere accessing the data.Beta Was this translation helpful? Give feedback.
All reactions