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

Prevent caching private responses server-side #834

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

edwinveldhuizen
Copy link
Contributor

When a server returns private in the cache-control header, you do not want to cache it unless on a private device like a browser.

Copy link

codecov bot commented May 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.26%. Comparing base (f0ba5ad) to head (dc0443b).
Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #834   +/-   ##
=======================================
  Coverage   99.26%   99.26%           
=======================================
  Files          19       19           
  Lines        2442     2448    +6     
  Branches      212      211    -1     
=======================================
+ Hits         2424     2430    +6     
  Misses         17       17           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@arthurfiorette
Copy link
Owner

I'm not sure if a typeof window === 'undefined' check is the correct one in this case. It also works on native apps? What about personal nodejs projects? There are infinite use cases here that aren't covered just by checking if windows is defined.

@edwinveldhuizen
Copy link
Contributor Author

edwinveldhuizen commented May 15, 2024

I'm not sure if a typeof window === 'undefined' check is the correct one in this case. It also works on native apps? What about personal nodejs projects? There are infinite use cases here that aren't covered just by checking if windows is defined.

Good point about apps! What would you suggest as an alternative? A config option called “allowPrivate”?

@arthurfiorette
Copy link
Owner

arthurfiorette commented May 21, 2024

Good point about apps! What would you suggest as an alternative? A config option called “allowPrivate”?

Seems fine! Default it to false to keep the previous behavior and add it do our docs.

@arthurfiorette arthurfiorette added enhancement New feature or request good first issue Good for newcomers labels May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants