fix: add proper cache control headers for all public endpoints#1863
Open
netomi wants to merge 3 commits into
Open
fix: add proper cache control headers for all public endpoints#1863netomi wants to merge 3 commits into
netomi wants to merge 3 commits into
Conversation
Comment on lines
+213
to
+216
| return ResponseEntity.status(HttpStatus.FOUND) | ||
| .cacheControl(CacheControl.maxAge(1, TimeUnit.DAYS).cachePublic()) | ||
| .location(URI.create(itemUrl)) | ||
| .build(); |
Comment on lines
+272
to
+275
| return ResponseEntity.status(HttpStatus.FOUND) | ||
| .cacheControl(CacheControl.maxAge(1, TimeUnit.DAYS).cachePublic()) | ||
| .location(URI.create(downloadUrl)) | ||
| .build(); |
gnugomez
reviewed
May 22, 2026
Member
gnugomez
left a comment
There was a problem hiding this comment.
why instead of setting them manually don't you add a global config in the SecurityConfig#filterChain?
Contributor
Author
|
as we do not want the same cache control for all endpoints, they at least slightly differ. Till I have a better way to express that I just do it consistently for all endpoints, as some where omitted so far, and 404 did not have any. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, some endpoints did not include proper or inconsistent cache control headers.
This leads to the situation that responses can not be cached on the CDN level as it honors the cache control headers returned by the application.
This PR sets the cache control headers consistently for all public API endpoints:
Currently for the majority of the endpoints we set 10min as max-age which is reasonable (changes will be reflected after max 10 min afaict), but this should be configurable.