A static gallery website built with HTML5 Boilerplate.
aws s3 sync --acl public-read --sse --delete [project path] s3://sebs.gallery --exclude ".git/*"
When syncing content to S3 bucket for static site hosting, users sometimes get weird old versions due to CloudFront caching. Here's how to fix it:
- Go to CloudFront Console in AWS
- Select your distribution (the one serving your S3 bucket)
- Click the "Invalidations" tab
- Click "Create Invalidation"
- Enter paths to invalidate:
/*- invalidates everything (use sparingly, costs more)/index.html- invalidates specific files/css/*- invalidates specific directories
- Click "Invalidate"
Note: You get 1,000 free invalidation paths per month, then $0.005 per path.
For End Users:
- Hard refresh:
Ctrl+F5(Windows) orCmd+Shift+R(Mac) - Clear browser cache manually
- Open in incognito/private mode
For Development:
- Add cache-busting query parameters:
style.css?v=20240101 - Set appropriate
Cache-Controlheaders on S3 objects:- HTML files:
Cache-Control: max-age=300(5 minutes) - CSS/JS files:
Cache-Control: max-age=31536000(1 year) with versioning - Images:
Cache-Control: max-age=2592000(30 days)
- HTML files:
- Sync files to S3:
aws s3 sync . s3://your-bucket-name --delete - If using CloudFront, create invalidation for updated paths
- Test in incognito mode to verify updates
Built on HTML5 Boilerplate. See doc/usage.md for detailed documentation.
css/- Stylesheetsjs/- JavaScript filesimg/- Image assetscontent/- Markdown content filesvideo/- Video assets