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
{{ message }}
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
The notices/alerts I set in the flash are somehow persisted across requests when cookies are unset, whether it's through use of a before_filter or rack middleware. The result is that the same message is shown over and over, until the user reaches an action that doesn't remove cookies.
The text was updated successfully, but these errors were encountered:
I went around the issue by adding if flash.empty? to request.session_options[:skip] = true in both controller methods. That way the browser receives the instruction to clear the flash from the cookie. This has the double advantage of setting a Set-Cookie header, which tells fastly uses to not cache the page. End result: pages with a flash are not cached, yeay!
If anybody has any cleaner way of dealing with this, please let me know!
When we tried to use @blarralde's approach, we ran into a problem where the cache would repeatedly miss after a flash message was shown. We solved the whole issue using AJAX, but ESI could accomplish something similar. Our approach was inspired by this article: https://www.fastly.com/blog/caching-uncacheable-csrf-security
We extracted the flashes to an api endpoint called /flashes.json and built a controller for it.
The notices/alerts I set in the flash are somehow persisted across requests when cookies are unset, whether it's through use of a before_filter or rack middleware. The result is that the same message is shown over and over, until the user reaches an action that doesn't remove cookies.
The text was updated successfully, but these errors were encountered: