-
Notifications
You must be signed in to change notification settings - Fork 3
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
Blitz caching the Edit Entry button #69
Comments
Joshua correctly pointed out that I was mis-reading |
Can we do a check in the module to see if Blitz exists and if it does, only output this if the Debug Toolbar is also visible?
|
👏 This seems good to go in 605fb74 |
The red "Edit Entry" sometimes ends up in Blitz or CDN cached versions of the site.
We should explore a few different options to prevent this from happening when content editors view the front-end of the site.
There are a few caching layers
Change to Viget.com module code (no-cache headers for admins)
Details:
Across a few sites that use this module with the Blitz plugin (e.g. ADC-AMH, Viget) sometimes the
Edit Entry
button gets cached in the Blitz static cache for all users.It was a misunderstanding that Blitz automatically does not cache or serve cached assets to signed-in users, but in looking at the source code the logic is as follows:
Blitz is only checking:
($user !== null) && (!Craft::$app->getIsLive() && !$user->can('accessSiteWhenSystemIsOff'))
($user !== null) && ($user->getPreference('enableDebugToolbarForSite'))
(!empty($request->getParam('no-cache')))
($request->getToken() !== null && !$this->getIsGeneratorRequest())
During development, Viget developers (cough me) have the debug toolbar visible so the caching issue was not immediately evident or consistent. Seeing that this Blitz logic checks for the
no-cache
header, add a no-cache header to all pages that show the Edit Entry buttonLooking at the Craft 4 code for
Response
there may be a public functionsetNoCacheHeaders()
or else the module might need to do something likeRef:
The text was updated successfully, but these errors were encountered: