API Platform version(s) affected: v4.3.10 (api-platform/laravel + api-platform/http-cache)
Description
SouinPurger (and its parent SurrogateKeysPurger) hardcodes Request::METHOD_PURGE when calling the invalidation endpoint. However, the Caddy cache-handler management API (documented for use at http://caddy:2019/souin-api/souin) only supports DELETE with a Surrogate-Key header — it does not handle PURGE. Sending PURGE to that endpoint returns an empty response, causing API Platform to throw a 500 on every mutation even though the write itself succeeded.
Additionally, the performance documentation shows this for Laravel:
'purger' => 'api_platform.http_cache.purger.souin',
This is a Symfony DI service alias. In Laravel, ApiPlatformEventProvider resolves the purger via class_exists() then $app->make() — a service ID string will throw InvalidArgumentException ("class not found") or fail DI resolution. The correct value for Laravel is the FQCN (\ApiPlatform\HttpCache\SouinPurger::class), but even that triggers the PURGE issue above.
How to reproduce
- Set up FrankenPHP + Caddy cache-handler with
api { basepath /souin-api; souin } on port 2019
- Configure Laravel as per the docs with
SouinPurger
- Send any
POST/PATCH/DELETE — response is 500: "Empty reply from server for http://localhost:2019/souin-api/souin"
- Confirm the mismatch:
DELETE /souin-api/souin + Surrogate-Key: test → 200 OK
PURGE /souin-api/souin → empty reply
Possible Solution
- Make
SurrogateKeysPurger::getChunkedIris() protected instead of private so subclasses can override purge() without duplicating the chunking logic.
- Add a constructor parameter for the HTTP method so users can choose without writing a full custom purger.
- Fix the Laravel docs example to use the FQCN instead of the Symfony service alias, or update
ApiPlatformEventProvider to support service ID resolution for the purger config key.
API Platform version(s) affected: v4.3.10 (
api-platform/laravel+api-platform/http-cache)Description
SouinPurger(and its parentSurrogateKeysPurger) hardcodesRequest::METHOD_PURGEwhen calling the invalidation endpoint. However, the Caddy cache-handler management API (documented for use athttp://caddy:2019/souin-api/souin) only supportsDELETEwith aSurrogate-Keyheader — it does not handlePURGE. SendingPURGEto that endpoint returns an empty response, causing API Platform to throw a 500 on every mutation even though the write itself succeeded.Additionally, the performance documentation shows this for Laravel:
This is a Symfony DI service alias. In Laravel,
ApiPlatformEventProviderresolves the purger viaclass_exists()then$app->make()— a service ID string will throwInvalidArgumentException("class not found") or fail DI resolution. The correct value for Laravel is the FQCN (\ApiPlatform\HttpCache\SouinPurger::class), but even that triggers the PURGE issue above.How to reproduce
api { basepath /souin-api; souin }on port 2019SouinPurgerPOST/PATCH/DELETE— response is 500:"Empty reply from server for http://localhost:2019/souin-api/souin"DELETE /souin-api/souin+Surrogate-Key: test→ 200 OKPURGE /souin-api/souin→ empty replyPossible Solution
SurrogateKeysPurger::getChunkedIris()protectedinstead ofprivateso subclasses can overridepurge()without duplicating the chunking logic.ApiPlatformEventProviderto support service ID resolution for the purger config key.