Repository navigation
Description
Bug description
When moving (= changing parent page) or removing a page, its statically cached version remains intact. So after moving or removing a page, one can still visit its frontend URL and view it.
In case of moving a page, when an editor has the frontend of the page open on its old URL, changes suddenly stop appearing in the frontend of the page after moving it. That's rather confusing. I believe it can also cause duplicate content issues.
In case of deleting a page, it's not ideal if the page is still around in the frontend of the site after it's deleted.
I'd expect getting a 404 in both cases. When an entry is moved or deleted, it would be nice if the corresponding static cache file(s) would automatically be deleted 🙂
I'll be out on holiday for the coming week, so it might take me a while to respond if there are any additional questions.
How to reproduce
For moving pages:
- Turn on static caching (in my case, half measure static caching)
- Create a page
- Add some content
- Visit the page URL and keep it open
- Change the page's parent and save the page
- Change the page's content and save again
- Refresh the frontend of the page that was already open. Changes do not come through, nor do you get a 404.
For deleting pages:
- Turn on static caching again
- Create a page
- Visit the page URL, keep it open
- Delete the page
- Refresh the page frontend; it will still show up.
Logs
No response
Environment
Environment
Application Name: {site name}
Laravel Version: 10.26.2
PHP Version: 8.2.15
Composer Version: 2.7.1
Environment: production
Debug Mode: OFF
URL: {site url}
Maintenance Mode: OFF
Cache
Config: CACHED
Events: NOT CACHED
Routes: CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: postmark
Queue: sync
Session: file
Statamic
Addons: 2
Antlers: runtime
Stache Watcher: Enabled
Static Caching: half
Version: 4.42.1 PRO
Statamic Addons
ddm-studio/cookie-byte: 1.4.3
stoffelio/statamic-turnstile: 1.1.0Installation
Fresh statamic/statamic site via CLI
Antlers Parser
Runtime (default)
Additional details
No response
Activity
jasonvarga commentedon Feb 21, 2024
Can you please provide
config/statamic/sites.php?wiegertschouten commentedon Feb 26, 2024
@jasonvarga sure:
duncanmcclean commentedon Feb 26, 2024
Can you try using the app url as the site's URL instead? Like this:
'default' => [ 'name' => config('app.name'), 'locale' => 'en_US', - 'url' => '/', + 'url' => config('app.url'), ],wiegertschouten commentedon Feb 26, 2024
@duncanmcclean sure, I now have the following config:
However, the problem persists 🙁
duncanmcclean commentedon Feb 27, 2024
Is the
APP_URLcorrect in your.env? Is ithttpsinstead ofhttp?Just checking since ^ fixed some invalidation issues for others recently so want to make sure it's not the same issue here.
wiegertschouten commentedon Feb 27, 2024
Just double-checked it, and yes, it's
https, which the site is also on. I also have the issue locally on Laravel Herd. Which is also HTTPS, and properly configured via the.envas well.In case it helps, my
config/statamic/static_caching.phplooks like this:wiegertschouten commentedon Feb 28, 2024
To double check this issue, I created a fresh Statamic install. I set the static caching strategy to
half, and then followed the steps described above in order to reproduce the problem.It turns out the problem does not occur when I delete a page. It properly gives a 404 in the frontend after deletion.
However, when I move a page, it's still visible on its old URL. So this narrows the problem down a bit: when moving an entry (= changing its parent entry) the static cache is not properly invalidated.
[-]Statically cached pages not removed when moving or deleting a page[/-][+]Statically cached pages not removed when moving a page[/+]