Skip to content

[5.x] Static Cache Middleware - skip cache if new header is set #11817

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

Merged
merged 2 commits into from
May 28, 2025

Conversation

macaws
Copy link
Contributor

@macaws macaws commented May 23, 2025

We do not have a way to determine ourselves if something should be skipped or not.

One option would have been to add X-Statamic-Draft to the headers, but this seemed "dirty". A new header allows us to skip the cache conditionally: X-Statamic-No-Static-Cache and would work well for others as well - it's clear, to-the-point, and distinct.

Our use case: we do NOT want to cache 404 responses in some instances - so we want to add that header where applicable.

Considered also X-Statamic-Skip-Static-Cache, but opted for shorter version with "No" instead of "Skip". Also considered X-Statamic-No-Cache, but thought that might be confused with Nocache (a separate implementation).

Copy link
Member

@duncanmcclean duncanmcclean 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 the PR!

I've changed it to X-Statamic-Uncacheable as I think that fits a little better alongside the other header names.

@duncanmcclean duncanmcclean merged commit 20e7660 into statamic:5.x May 28, 2025
24 checks passed
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.

2 participants