Skip to content

fix(laravel): purge the HTTP cache on GraphQL mutations - #8782

Open
BenMacha wants to merge 3 commits into
api-platform:5.0from
BenMacha:fix-laravel-http-cache-purge-5-0
Open

BenMacha wants to merge 3 commits into
api-platform:5.0from
BenMacha:fix-laravel-http-cache-purge-5-0

Conversation

@BenMacha

@BenMacha BenMacha commented Nov 1, 2026

Copy link
Copy Markdown
Q A
Branch? 5.0
Tickets
License MIT
Doc PR

With HTTP cache invalidation enabled on Laravel, the eloquent.saved/eloquent.deleted listeners that collect the IRIs to purge were only registered by the REST controller: a GraphQL mutation never purged anything, so REST clients kept getting the stale item and collection. The GraphQL entrypoint now registers them too. The Varnish purger also ignored http_cache.invalidation.max_header_length, which the other purgers receive.

Tests: src/Laravel/Tests/GraphQlPurgerTest.php (new) and PurgerTest.

The Eloquent saved/deleted listeners collecting cache tags were only
registered by the REST controller, so a GraphQL mutation changed data
without purging anything and cached GET responses stayed stale.
The GraphQL entrypoint now registers the same listeners.
VarnishPurger was built without the configured
api-platform.http_cache.invalidation.max_header_length, unlike the xkey and
Souin purgers, so it always used its 8000 default and could send BAN headers
larger than the cache server accepts.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-01T08:06:06.571620Z
We couldn’t complete this review. Comment @codex review to try again.
15c243d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

1 participant