I have a website developed using Flask framework. I want to cache all my pages to make my website faster and increase traffic on search engines. However, the page has user-specific dynamic content. I would really appreciate it if you could tell me how to cache dynamic content.
CodePudding user response:
User-specific dynamic content is only good for one user, so caching it is not useful, and Cloudflare doesn't cache it by default. If you force it to, it will break your site, because users will get content intended for other users.
Cloudflare will, however, cache your images, CSS, Javascript, and so forth.
CodePudding user response:
I solved this dynamic content caching problem using ajax requests for user-specific data. After loading static content, I requested user-specific data such as current user information via ajax. I set cache option to false when making ajax request. In this way, I can solve the dynamic content caching problem.