Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(imagor): Expire Filter: Cache-Control response header #376

Merged
merged 3 commits into from
Jul 26, 2023

Conversation

headegg
Copy link
Contributor

@headegg headegg commented Jul 23, 2023

Previously, any request which used the expire() filter always set Cache-Control: "private, no-cache, no-store, must-revalidate" in the response.

As discussed here, it would be nice to be able to cache these responses in the browser, up to the expiry timestamp or imagor's configured cache ttl - whichever of the 2 is sooner.

This pull request makes the following changes:

  • respect Cache-Control: private header, if present in the request and set the response Cache-Control header accordingly
  • automatically set the private cache control request header when the expire() filter is used (assume resources with expiry are more sensitive and only to be cached privately)
  • Set max-age in the Cache-Control response header to be either the seconds between now and the expire timestamp or imagor's configured ttl, whichever is the smaller.

@cshum
Copy link
Owner

cshum commented Jul 26, 2023

Hi would you please merge from master branch again?

@headegg
Copy link
Contributor Author

headegg commented Jul 26, 2023

Hi @cshum. That's done. Thanks.

Copy link
Owner

@cshum cshum left a comment

Choose a reason for hiding this comment

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

Thanks!

@cshum cshum merged commit e130b8a into cshum:master Jul 26, 2023
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.

3 participants