Skip to content

Instantly share code, notes, and snippets.

@stackdump
Created January 28, 2026 09:47
Show Gist options
  • Select an option

  • Save stackdump/d7d2c224c1954de658a18ef7ecd4ede0 to your computer and use it in GitHub Desktop.

Select an option

Save stackdump/d7d2c224c1954de658a18ef7ecd4ede0 to your computer and use it in GitHub Desktop.
How to purge jsdelivr CDN cache when @latest points to an old GitHub release

Purging jsdelivr CDN Cache

When using cdn.jsdelivr.net/gh/{owner}/{repo}@latest/..., the @latest tag resolves to the latest GitHub Release (not just a git tag).

Common issue

You push a new tag but @latest still serves the old version because:

  1. The tag has no corresponding GitHub Release
  2. jsdelivr caches responses for up to 7 days

Fix

1. Create a GitHub Release for your tag

gh release create v1.11.1 --title "v1.11.1" --notes "Release notes here"

2. Purge the CDN cache

Replace cdn.jsdelivr.net with purge.jsdelivr.net:

curl -s "https://purge.jsdelivr.net/gh/{owner}/{repo}@latest/path/to/file.js"

3. Verify

curl -sI "https://cdn.jsdelivr.net/gh/{owner}/{repo}@latest/path/to/file.js" | grep x-jsd-version

Should now show the new version.

Notes

  • @latest only looks at GitHub Releases, not bare git tags
  • Cache TTL is max-age=604800 (7 days) for @latest URLs
  • Pinned version URLs like @v1.11.1 have a 1-year cache but are immutable, so no purge needed
  • The purge API is public and requires no authentication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment