- Issue: The service worker wasn't excluding
assets.justevery.comfrom caching - Fixed: Updated to exclude
assets.justevery.comfrom service worker cache - Impact: Browsers might cache failed responses or route assets incorrectly
Critical Question: Is assets.justevery.com configured as a direct R2 custom domain or is it routing through the Worker?
If assets.justevery.com routes through the Worker:
- Initial requests work (Worker is fresh)
- Worker exhausts resources serving large videos
- Subsequent requests fail
- This would explain the delayed failure pattern
If the Worker fails and returns error responses, these might be cached by:
- Browser cache
- Service worker cache (now fixed)
- Cloudflare's edge cache
- Any intermediate CDN layers
-
Check R2 Custom Domain Configuration
- Log into Cloudflare Dashboard
- Navigate to R2 → Your Bucket → Settings
- Verify
assets.justevery.comis configured as a PUBLIC custom domain - Ensure it's NOT configured as a Worker route
-
Test Direct Access
# Test if assets are accessible directly curl -I https://assets.justevery.com/video/promo-854w.mp4 # Check response headers for caching directives curl -I https://justevery.com/ | grep -i cache
-
Check Worker Routes
- In Cloudflare Dashboard → Workers & Pages
- Check if
assets.justevery.com/*is listed as a route - It should NOT be there - assets should bypass Workers entirely
- Configure
assets.justevery.comas R2 public custom domain - Remove any Worker routes for
assets.justevery.com - Update DNS to point directly to R2
If assets must go through Worker, add headers to prevent caching of errors:
// In Worker response
headers.set('Cache-Control', 'no-cache, no-store, must-revalidate');Add a health check endpoint that verifies:
- Worker memory usage
- Asset availability
- Response times
-
Clear all caches:
- Cloudflare cache purge (already in deployment)
- Increment service worker version to force update
- Add cache-busting query params to video URLs
-
Verify routing:
- Confirm assets.justevery.com bypasses Worker
- Check Cloudflare dashboard for proper configuration
-
Monitor:
- Use
wrangler tailto watch Worker logs - Check for memory/CPU limit errors
- Monitor asset loading in browser DevTools
- Use
Without access to Cloudflare logs, the most likely scenario is:
assets.justevery.comis routing through the Worker (not direct to R2)- Worker serves videos initially but exhausts resources
- Failed responses get cached
- Site appears broken even after Worker recovers
The fix is to ensure assets.justevery.com is a direct R2 custom domain, bypassing the Worker entirely.