Skip to content

Fix/cache control header#242

Merged
ogorzalka merged 2 commits intoPollora:developfrom
chermant:fix/cache_control_header
Mar 19, 2026
Merged

Fix/cache control header#242
ogorzalka merged 2 commits intoPollora:developfrom
chermant:fix/cache_control_header

Conversation

@chermant
Copy link
Contributor

No description provided.

dependabot bot and others added 2 commits December 4, 2025 09:17
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.1.0 to 4.1.1.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](nodeca/js-yaml@4.1.0...4.1.1)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…s middleware

WordPress calls PHP's native header() via nocache_headers(), which stores
`no-cache, no-store, must-revalidate, max-age=0` in the PHP native header
queue — not in Symfony's header bag.

When shouldSetPublicCache() was true (unauthenticated users), the middleware
called addCacheControlDirective('must-revalidate') on top of the WordPress
headers already queued natively. Since Symfony sends its headers with
replace=false (except Content-Type), both Cache-Control values coexisted and
were concatenated by the browser, resulting in:

  Cache-Control: no-cache, must-revalidate, max-age=0, public, max-age=3600, must-revalidate

Fix: before rebuilding the public cache directives, flush Cache-Control at
both levels:
- header_remove('Cache-Control') clears the PHP native queue (WordPress headers)
- $response->headers->remove('Cache-Control') clears the Symfony bag

The resulting header for unauthenticated users is now clean:

  Cache-Control: public, must-revalidate, max-age=3600
@ogorzalka ogorzalka merged commit 3879efc into Pollora:develop Mar 19, 2026
1 of 5 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