Repository navigation
feat: add stale-if-error on served packages - #1426
Merged
Merged
Conversation
|
Please ensure that Also, it would be nice if we could address decision regarding asynchronous revalidation ( |
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.
Issue:
Cache-Controlwithstale-while-revalidate/stale-if-errordirectives. #1257Problem:
When esm.sh goes down, it is not realistically able to survive on cache. This is due to how the cache-control header is configured and how a lot of packages don't define a strict version for their dependencies. When requesting a package from esm you are able to define a strict version, but you don't control the versioning of transitive packages. They could be defined without a strict version, e.g
^0.27.0. This transitive package is required for your package to work, but is only cached 10 minutes, making fact that a striced versioned package is cached for a day not a good mechanism for surviving esm.sh downtimes.Fix:
Adding
stale-if-errordirectives to the cache-control header will give proxy/caches in front the ability to serve the content while the service is unavailable.Change:
stale-if-error=86400on cache-control header used to serve esm packages. This allows for a day worth of downtime.