[Serverless / Cloudflare R2] Use the ETag of the R2 object as a cache busting URL parameter #552
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.
This is more of a first draft than a completed PR, but I wanted some feedback on the implementation before cleaning it up and updating documentation. I'm especially interested in whether something like this belongs in the repository at all, and what kind of documentation / configuration would be appropriate for a feature of this kind.
Motivation: In the docs, it's recommended to reset the cache by resetting the cache for the whole domain, which can be a bit tedious sometimes. This implementation uses the ETag of the R2 object as a
?v=...query string on the tile URLs, so uploading a new PMTiles file will trigger changing the URL in the tiles.json endpoint, which won't be in the cache. I set the default cache-control to something short like 30 seconds in my deploy.I've set the Cache-Control of the tiles.json endpoint to the environment variable to match the original behavior, but it might make sense to split it out to a different variable??