-
-
Notifications
You must be signed in to change notification settings - Fork 1
Limit page cache storage to successful HTML responses #83
Copy link
Copy link
Closed
Labels
area: cachePage cache, menu cache, preload, invalidation, observability, or cache settings.Page cache, menu cache, preload, invalidation, observability, or cache settings.area: frontendPublic-facing frontend output, assets, feeds, headers, or visitor behavior.Public-facing frontend output, assets, feeds, headers, or visitor behavior.bugConfirmed or likely defect affecting runtime behavior, UX, compatibility, or data handling.Confirmed or likely defect affecting runtime behavior, UX, compatibility, or data handling.priority: highImportant for the next planned release or high user impact.Important for the next planned release or high user impact.risk: release-blockerShould be resolved or explicitly deferred before the target release ships.Should be resolved or explicitly deferred before the target release ships.status: readyScoped enough for implementation without major open questions.Scoped enough for implementation without major open questions.
Milestone
Metadata
Metadata
Assignees
Labels
area: cachePage cache, menu cache, preload, invalidation, observability, or cache settings.Page cache, menu cache, preload, invalidation, observability, or cache settings.area: frontendPublic-facing frontend output, assets, feeds, headers, or visitor behavior.Public-facing frontend output, assets, feeds, headers, or visitor behavior.bugConfirmed or likely defect affecting runtime behavior, UX, compatibility, or data handling.Confirmed or likely defect affecting runtime behavior, UX, compatibility, or data handling.priority: highImportant for the next planned release or high user impact.Important for the next planned release or high user impact.risk: release-blockerShould be resolved or explicitly deferred before the target release ships.Should be resolved or explicitly deferred before the target release ships.status: readyScoped enough for implementation without major open questions.Scoped enough for implementation without major open questions.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Finding
The page-cache writer only skips empty output, responses with status code >= 400, and responses that set cookies. It does not require a 200/OK response and does not verify that the response is HTML before writing cache files.
Evidence
src/Modules/Cache/PageCache.phpstore_cache()skipshttp_response_code() >= 400but allows 3xx responses and other non-200 statuses.Set-Cookieheaders but does not skipLocationredirects or non-HTMLContent-Typeresponses before writing metadata and body files.Impact
Redirects or other non-HTML frontend responses can be captured as page-cache entries. Later visitors may receive stale or incorrect cached output without the original response headers, which can break redirects, plugin endpoints, or theme-level responses.
Suggested fix
Only write cache files for successful cacheable HTML responses. At minimum, require HTTP 200 and skip when
Locationheaders are present. Prefer also checking responseContent-Typewhen available and allowing onlytext/html.Acceptance criteria