Conversation
Before this change, ballot image URLs would look like: * `/play/100/cover` * `/play/100/full_cover` And they would have `Cache-Control: max-age=86400`, 24 hour caching. If an author tried to change their cover image, it would not take effect for end users for up to 24 hours. Now, ballot image URLs include the hash of their content: * `/play/100/cover/6f3258d40362b2c5` * `/play/100/full_cover/184051209a39ecc8` These URLs have `Cache-Control: public, max-age=31536000, immutable`, i.e. far-future immutable caching. The hash is stored in `geometry.txt` for the web cover, and in `hash.txt` for the full cover. The ballot reads the stored hashes to generate HTML like this: ``` <a href="/play/100/full_cover/184051209a39ecc8"> <img src="/play/100/cover/6f3258d40362b2c5"> </a> ``` When the author uploads a new image, the ballot HTML (which is never cached) instantly uses new URLs for the image, making the latest cover art immediately visible to judges. Judges never need to redownload images that are already cached.
Contributor
Author
If we use Cloudflare, Cloudflare will cache these images at the edge, so users will never have to download images directly from |
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.
Before this change, ballot image URLs would look like:
/play/100/cover/play/100/full_coverAnd they would have
Cache-Control: max-age=86400, 24 hour caching. If an author tried to change their cover image, it would not take effect for end users for up to 24 hours.Now, ballot image URLs include the hash of their content:
/play/100/cover/6f3258d40362b2c5/play/100/full_cover/184051209a39ecc8These URLs have
Cache-Control: public, max-age=31536000, immutable, i.e. far-future immutable caching.The hash is stored in
geometry.txtfor the web cover, and inhash.txtfor the full cover.The ballot reads the stored hashes to generate HTML like this:
When the author uploads a new image, the ballot HTML (which is never cached) instantly uses new URLs for the image, making the latest cover art immediately visible to judges. Judges never need to redownload images that are already cached.