Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Added the ability for Protectors to allow static caching #11212

Open
wants to merge 4 commits into
base: 5.x
Choose a base branch
from

Conversation

kingsven
Copy link
Contributor

@kingsven kingsven commented Dec 3, 2024

This PR provides the ability for protected entries to be allowed in the static cache and addresses the concerns outlined in the comments on #10929

It also may be worth considering either defaulting statamic.protect.cacheable to true on update of statamic/cms so that the original behaviour doesn't change for existing deployments. Any thoughts/feedback on this?

Closes statamic/ideas#1234.

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this.

I can't see a good reason to let people add 'cacheable' => true in their config.

The whole reason we made "fix" where protected pages aren't cached is so that people don't unintentionally make private pages public. Adding a setting just lets people opt into that flaw, maybe unintentionally.

A custom driver though, sure. In your case you've said that your driver is smart and can know more about the cache.

So unless you have a compelling argument against it, would you mind reverting the config, and just allow drivers to override their own cacheable method? The Protector@cacheable method can just return false.

Even if you wanted to make the IP driver cacheable, for example, you could make a custom driver that extends ours and just override the cacheable method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to use Protection & Static Caching together
3 participants