perf: Add aggresive cache-control headers for files and assets#157
Merged
perf: Add aggresive cache-control headers for files and assets#157
Conversation
Avoid ocassional request to validate, if hash matches then there's no need to ever validate the URLs. ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
We have no cache headers at all on public files, so except browsers trying to heuristically cache things, they don't end up getting cached.
ankush
added a commit
to ankush/frappe
that referenced
this pull request
Jan 17, 2025
- Client(browser) side cache - 1 hr expiry - 1 day revalidation - etagged by nginx in default config (so no data transfer on expiry still) In conjunction with frappe/agent#157
ankush
added a commit
to frappe/frappe
that referenced
this pull request
Jan 17, 2025
* perf: add cache-control headers on private files - Client(browser) side cache - 1 hr expiry - 1 day revalidation - etagged by nginx in default config (so no data transfer on expiry still) In conjunction with frappe/agent#157 * fix: Don't override existing headers
mergify Bot
pushed a commit
to frappe/frappe
that referenced
this pull request
Jan 20, 2025
* perf: add cache-control headers on private files - Client(browser) side cache - 1 hr expiry - 1 day revalidation - etagged by nginx in default config (so no data transfer on expiry still) In conjunction with frappe/agent#157 * fix: Don't override existing headers (cherry picked from commit 320798d) # Conflicts: # frappe/app.py
mergify Bot
pushed a commit
to frappe/frappe
that referenced
this pull request
Jan 20, 2025
* perf: add cache-control headers on private files - Client(browser) side cache - 1 hr expiry - 1 day revalidation - etagged by nginx in default config (so no data transfer on expiry still) In conjunction with frappe/agent#157 * fix: Don't override existing headers (cherry picked from commit 320798d) # Conflicts: # frappe/app.py
This was referenced Jan 20, 2025
ankush
added a commit
to frappe/frappe
that referenced
this pull request
May 2, 2025
…29860) * perf: add cache-control headers on private files (#29221) * perf: add cache-control headers on private files - Client(browser) side cache - 1 hr expiry - 1 day revalidation - etagged by nginx in default config (so no data transfer on expiry still) In conjunction with frappe/agent#157 * fix: Don't override existing headers (cherry picked from commit 320798d) # Conflicts: # frappe/app.py * chore: conflicts --------- Co-authored-by: Ankush Menat <ankush@frappe.io>
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.
/assetscache immutable, they have hashes anyway./files/*(copied the list from press)In the worst case,
ctrl+shift+rfixes any kind of stale cache anyway because they sendno-cacheheader to the server./files/*also have etag so even after invalidation it will just be refreshed using the etag.The numbers are still not that aggressive but they are better than 0, we can increase over time if we don't see any issue.