Skip to content

docs(performance): document HEAD request body-skip optimization#2312

Open
soyuka wants to merge 1 commit into
api-platform:mainfrom
soyuka:docs/head-request-optimization
Open

docs(performance): document HEAD request body-skip optimization#2312
soyuka wants to merge 1 commit into
api-platform:mainfrom
soyuka:docs/head-request-optimization

Conversation

@soyuka

@soyuka soyuka commented Jul 12, 2026

Copy link
Copy Markdown
Member

Documents the HEAD request body-skip optimization introduced in api-platform/core#8348 (ships in 4.4).

What

On HEAD requests, API Platform no longer builds the response body: the collection is never iterated (no row SELECT) and serialization is skipped. Enabled by default.

Two observable changes vs. previous GET-equivalent HEAD handling:

  • Content-Length no longer set on HEAD (RFC 9110 §9.3.2).
  • Cache-Tag/xkey headers no longer emitted on HEAD (previously tag-purgeable; now TTL-only).

Plus: Allow header no longer advertises HEAD for resources without a GET operation.

Changes

  • core/performance.md: new HEAD Request Optimization section — behavior, BC-relevant changes, and how to disable (Symfony + Laravel).
  • core/configuration.md: added enable_head_request_optimization (default true) to both the Symfony and Laravel config references.

Depends on api-platform/core#8348.

HEAD requests now skip response body construction by default (the
collection is never iterated and serialization is skipped). This
changes observable behavior: Content-Length is no longer set, and
Cache-Tag/xkey headers are no longer emitted on HEAD responses.
Document the enable_head_request_optimization flag (Symfony and
Laravel) to restore the previous GET-equivalent behavior, and note
that the Allow header no longer advertises HEAD without a GET
operation.
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