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

404 errors are cached with »half« static caching #10758

Open
florianbrinkmann opened this issue Sep 4, 2024 · 5 comments
Open

404 errors are cached with »half« static caching #10758

florianbrinkmann opened this issue Sep 4, 2024 · 5 comments
Labels

Comments

@florianbrinkmann
Copy link

Bug description

I noticed that 404 pages are cached when half static caching is active. That’s not the case with full static caching.

How to reproduce

  • Activate half static caching
  • Create and publish two pages, one with the slug parent and one with the slug child, both on the top level of the page tree.
  • View the URL /parent/child at the frontend, you get a 404 error
  • Move the child page in the page tree below the parent page and save the page tree
  • Visit /parent/child again and you still get the 404

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.21.0
PHP Version: 8.3.9
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: example.com
Maintenance Mode: OFF
Timezone: UTC
Locale: de

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: null
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled
Static Caching: half
Version: 5.17.0 PRO

Installation

Other (please explain)

Additional details

We use a custom starter kit at work, where I tested it, but it’s pretty basic without much modifications.

@duncanmcclean
Copy link
Member

Do you have the share_errors config option enabled in the config/statamic/static_caching.php config file?

@florianbrinkmann
Copy link
Author

Oh, didn’t knew about that option. But it’s not included in the static_caching.php in that project, so I guess it shouldn’t be enabled(?)

@duncanmcclean
Copy link
Member

duncanmcclean commented Sep 4, 2024

It's a new config option, so I just wondered if you had it enabled.

It looks like 404 are now cached when using half-measure caching. If you add that config option, it'll mean there's only 1 cached 404 page.

See #10294 for more details.

@jasonvarga
Copy link
Member

Yes, 404s are cached intentionally when using half measure.

@florianbrinkmann
Copy link
Author

And what about the described case that the collection tree changes so a cached 404 URL becomes a valid content URL?

@jasonvarga jasonvarga reopened this Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants