grav-coder icon indicating copy to clipboard operation
grav-coder copied to clipboard

Grav menu and cache

Open Japhys opened this issue 2 years ago • 4 comments

Still using this theme with much pleasure :)

You helped me with the log in / log out menu which works great. https://github.com/ParitoshBh/grav-coder/issues/25

The menu is cached though so you tend to see the logged in menu while actually logged out, for example because the session has expired. You will have to F5 the page. Is there a way to prevent this menu from being cached (ESI?) or maybe there is a better way to handle this?

Japhys avatar Mar 07 '22 18:03 Japhys

Hmm.. Interesting, I am not sure what a solution might be. I'll have to look through documentation. Will report back with findings.

ParitoshBh avatar Mar 22 '22 23:03 ParitoshBh

@Japhys So this appears to be plugin/Grav issue than the theme itself. Refer this thread https://github.com/getgrav/grav-plugin-login/issues/264

It has some potential solutions that you can try.

ParitoshBh avatar Mar 23 '22 01:03 ParitoshBh

I quickly tried on my dev instance following config,

  expires: 3600
  cache_control: 'private, max-age=0, must-revalidate'
  etag: true

This seems to work. However, I am no expert and will suggest you do some reading on what these cache control terms mean before using these - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control

ParitoshBh avatar Mar 23 '22 02:03 ParitoshBh

Thank you very much once again, I'll give it a try this weekend!

Japhys avatar Mar 26 '22 10:03 Japhys