0

I'm building a CMS website where most of the pages are static aside from the user menu at the top which either says "Log in" or "Logged in as Foo". Standard stuff.

I'd like to set a medium length Cache-control: max-age header (e.g. a few hours) on the static pages so that navigation to already visited pages (like index pages) is instant. Dynamic member pages will be kept as no-cache.

The problem is that if an anonymous user visits a static page, logs in, then then visits the same page again, they will see the cached "Log in" menu when they should now see "Logged in as Foo".

I can think of a few solutions to this involving web workers or client side JavaScript but I can't find any examples. I'd rather not do anything too novel on this project as it's for a small client without a full time dev team. I'm hoping someone else has already solved what must be a very common problem.

Tamlyn
  • 18,041
  • 10
  • 96
  • 117

0 Answers0