knock-knock icon indicating copy to clipboard operation
knock-knock copied to clipboard

Automatically {% expires %}

Open seamusmh opened this issue 1 month ago • 2 comments

What are you trying to do?

Run Knock Knock on Craft Cloud. Static file caching interferes with login and accidentally allowed a private site to become public.

What's your proposed solution?

According to the docs, the fix for this is to add {% expires %} to the template. Ideally that would be done automatically so we don't have to remember to remove that code when the site launches. https://craftcms.com/docs/cloud/static-caching.html#opting-out

Additional context

@timkelty recommended filing a feature request for this to be automatically triggered by sites that have Knock Knock enabled after I filed a support request.

seamusmh avatar Nov 11 '25 19:11 seamusmh

Fixed for the next release. To get this early, run composer require verbb/knock-knock:"dev-craft-4 as 2.0.13" or composer require verbb/knock-knock:"dev-craft-5 as 3.0.4".

engram-design avatar Nov 11 '25 22:11 engram-design

@engram-design I'm not up to date on the details with this plugin necessarily, but should just be a matter of setting cache-control header (Craft::$app->getResponse()->setNoCacheHeaders() for anything that should categorically not be cached.

timkelty avatar Nov 12 '25 01:11 timkelty