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

Contributors Display sends HTTP header cache max age of 365 days #78

Open
skellytz opened this issue Jul 19, 2024 · 0 comments
Open

Contributors Display sends HTTP header cache max age of 365 days #78

skellytz opened this issue Jul 19, 2024 · 0 comments

Comments

@skellytz
Copy link

As a quick recap, there are three potential obstacles before a badge gets updated and displayed properly:

  1. the frequency of updates on shields.io side
  2. GitHub's own camo.githubusercontent.com cache (which can be purged faster with a scheduled action)
  3. the visitor's individual browser cache

For this report, let's focus on the third obstacle: the browser cache. Apparently, the HTML response header of the Contributors Display comes with cache-control: public, max-age=31536000, which basically means the browser is told to cache the badge's image for a whole year before requesting a newer version. In other words, the badge won't update the contributors unless the visitor manually purges the browser cache.

Most shields.io badges come with a relatively low cache max-age, e.g. release date: max-age=120, downloads counter: max-age=900, static badge: max-age=86400. Your Visits badge also comes with an acceptable cache-control: max-age=86400, s-maxage=86400 (24 hours). This is indeed reflected by visiting the affected repository; all badges get updated at some point except for Contributors Display which remains completely static until the browser cache is manually cleared.

Would it be possible to tweak the HTML header of Contributors Display to send a reasonable max-age=86400 rather than 365 days?

skellytz added a commit to Spellhold-Studios/Infinity-Animations that referenced this issue Sep 18, 2024
Contributors display badge doesn't update unless the user clears the browser cache.
More info: pujux/badge-it#78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant