In CloudFlare, present cached page only if cookie

2019-05-30 14:24发布

I'm trying to prevent CloudFlare from hitting our servers if a user is not logged in, but instead to get the cached object if possible. We're setting a cookie ('email') if the user is logged in, and clearing it when the user is logged out.

Is this possible?

2条回答
我欲成王,谁敢阻挡
2楼-- · 2019-05-30 15:07

In order to do this you can use a feature called "Bypass Cache on Cookie". This allows you to specify a Regex string of what type of cookie you want to Bypass:

Bypass Cache on Cookie

When used in conjunction with a Cache Everything Page Rule, you can use this setting to cache anonymous page views but bypass the cache when a cookie exists.

Further reading:

查看更多
啃猪蹄的小仙女
3楼-- · 2019-05-30 15:11

It is possible in Business plan only using page rules.

More info here.

查看更多
登录 后发表回答