How does Cloudflare handle pages behind a login wall?


#1

Beginner question: I couldn’t find anything in the docs about this.

How does Cloudflare handle (cache, etc) pages which are accessible only after a user has logged in?

By default, are these pages cached only for that user - or - for all users who subsequently login and access that page?

In my case, the entire site is behind a login. The pages themselves don’t change per user (they are the same per user).

Please advise, thank you


#2

Cloudflare has a list of static file extensions that it caches by default.

See here: https://support.cloudflare.com/hc/en-us/articles/200172516-Which-file-extensions-does-Cloudflare-cache-for-static-content-

If you want to cache something that’s not on there, you’ll need to write a page rule. e.g. to cache static HTML

So in your case, your pages wouldn’t be cached by default.


#3

Hmmm… Thanks for your reply. However, I’m not sure what file extensions have to do with my site being behind a login?

The pages are definitely being cached already, as I can see in the analytics and in the difference immediately when I purge.

To clarify, my main question is:

Are pages behind a login cached only for that user - or - for all users who subsequently login and access that page?


#4

Ah - I think I see what you mean - CF doesn’t cache the page itself, only those direct assets. But are they cached only for that user or for every user after login?


#5

They would be cached for every user.

Basically, when a user requests a asset that should be cached, it first checks Cloudflare’s cache. If it’s found, it delivers it from Cloudflare’s cache. If not, it would hit your origin server to get the asset and Cloudflare would cache it for subsequent requests.