Skip to content

Conversation

@alanpoulain
Copy link
Member

Q A
Branch? main
Tickets N/A
License MIT
Doc PR N/A

Some cache directives were missing from the AddHeadersProcessor, like no-store, this PR adds them.

@alanpoulain alanpoulain requested review from dunglas and soyuka March 8, 2025 17:35
@alanpoulain alanpoulain force-pushed the feat-cache-header-more-directives branch from 54c8d75 to 66ffb40 Compare March 8, 2025 19:15
'etag' => $this->etag && !$response->getEtag() ? hash('xxh3', (string) $content) : null,
'max_age' => null !== ($maxAge = $resourceCacheHeaders['max_age'] ?? $this->maxAge) && !$response->headers->hasCacheControlDirective('max-age') ? $maxAge : null,
// Cache-Control "s-maxage" is only relevant is resource is not marked as "private"
's_maxage' => false !== $public && null !== ($sharedMaxAge = $resourceCacheHeaders['shared_max_age'] ?? $this->sharedMaxAge) && !$response->headers->hasCacheControlDirective('s-maxage') ? $sharedMaxAge : null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add the public check logic? even though I agree I'm not sure we should handle this specific use case

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know but I didn't introduce this check, it was there in the previous code. It will be a BC to remove it.

@soyuka soyuka merged commit bf09616 into api-platform:main Mar 13, 2025
76 of 79 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