I have an app with Devise and Alchemy CMS and when I sign in, the button Login should change to Logout but it doesn't. I think that HTTP caching is enabled. If I logout, I get redirected to the home page and in the request header I can see this:
Status Code: 302
cache-control:no-cache
but if I go to another page the button still says "Logout". If I refresh the home page I see this in the header:
Request Method:GET
Status Code:200 (from disk cache)
cache-control:public
last-modified:Mon, 17 Dec 2018 19:32:08 GMT
If I login and go to another page the button says Login. In the header I see this:
Request Method:GET
Status Code:200 (from disk cache)
cache-control:public
last-modified:Mon, 17 Dec 2018 19:32:08 GMT
Is there a way I could fix that?
I had to upgrade to 4.0-stable which adds must_revalidate
to the headers and overwrite render_fresh_page?
method https://github.com/AlchemyCMS/alchemy_cms/blob/4.0-stable/app/controllers/alchemy/pages_controller.rb#L192
to look like this:
Alchemy::PagesController.class_eval do
def render_fresh_page?
flash.present? || !@page.cache_page? || stale?(etag: page_etag,
last_modified: @page.published_at,
public: !@page.restricted,
template: 'pages/show')
end
end