Ignoring specific HTML elements to cache


#1

Couldn’t find a solid answer, and more just want to know if it’s possible on any of the Cloudflare plans (currently on the Pro plan)

On the site’s homepage, we have the “Login/Join” link. When a user logs in, this should change to “Logout”, but with Cloudflare caching, it just servers whatever is cached. Is it possible to ignore certain elements like this?


#2

What you are looking for is not possible on the pro plan.

You have however the following options:

  • Switching to the Enterprise plan. Enterprise plans have access to bypass the cache on cookies.
  • Writing a worker that will switch out the dynamic elements. If you have any knowledge about Javascript, it should be fairly easy with all the recipes and examples available out there.
  • -or simply disable the cache everything rule.

#3

Thanks for the answer, that’s great. Just need to let the client know on possible options!


#4

This topic was automatically closed after 14 days. New replies are no longer allowed.