Add ability to cache by response content by OlegYch · Pull Request #13784 · playframework/playframework

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@OlegYch

Copy link Copy Markdown

Contributor

@OlegYch OlegYch commented

Feb 12, 2026

This brings Cached implementation closer to http spec by:

  1. actually using response content as described by https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/ETag
  2. preserving headers as described by https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/304

For compatibility reasons new ability is gated via play.cache.hashResponse config entry. It should probably become default in the future as the old ETag value based on expiration date (essentially random value) doesn't seem to be useful or specified anywhere in http.

fixes #13783

…and 200

This brings Cached implementation closer to http spec by:
1. actually using response content as described by https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/ETag
2. preserving headers as described by https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/304

For compatibility reasons new ability is gated via `play.cache.hashResponse` config entry.
It should probably become default in the future as the old ETag value based on expiration date (essentially random value) doesn't seem to be useful or specified anywhere in http.

closes playframework#13783

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Cached recalculates etag even if content did not change

2 participants

@OlegYch @mkurz