72 lines
2.7 KiB
Plaintext
72 lines
2.7 KiB
Plaintext
|
|
============================================
|
||
|
|
ROOT CAUSE & PERMANENT SOLUTION
|
||
|
|
============================================
|
||
|
|
Date: January 14, 2026
|
||
|
|
|
||
|
|
ROOT CAUSE IDENTIFIED:
|
||
|
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||
|
|
The website changes weren't reflecting due to TRIPLE-LAYER CACHING:
|
||
|
|
|
||
|
|
1. BROWSER CACHE
|
||
|
|
- Following 30-day cache headers sent by backend
|
||
|
|
|
||
|
|
2. NGINX CACHE
|
||
|
|
- /assets/ served with: Cache-Control: max-age=2592000 (30 days)
|
||
|
|
- Immutable flag prevents revalidation
|
||
|
|
|
||
|
|
3. BACKEND CACHE (backend/server.js)
|
||
|
|
- express.static maxAge: "30d" for /public
|
||
|
|
- express.static maxAge: "365d" for /assets
|
||
|
|
- express.static maxAge: "365d" for /uploads
|
||
|
|
- PM2 process keeps cache in memory
|
||
|
|
|
||
|
|
PERMANENT SOLUTION IMPLEMENTED:
|
||
|
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||
|
|
✅ 1. Cache-Busting Version Numbers
|
||
|
|
- Updated all HTML files from v=1768447584 → v=1768448784
|
||
|
|
- navbar.css?v=1768448784
|
||
|
|
- main.css?v=1768448784
|
||
|
|
- page-overrides.css?v=1768448784
|
||
|
|
- Forces browser to fetch new versions
|
||
|
|
|
||
|
|
✅ 2. Backend Restart
|
||
|
|
- PM2 restart skyartshop (PID: 458772)
|
||
|
|
- Clears express.static() memory cache
|
||
|
|
- Fresh process serves updated files
|
||
|
|
|
||
|
|
✅ 3. Nginx Configuration Fixed
|
||
|
|
- Corrected paths: /var/www/skyartshop/ → /media/pts/Website/SkyArtShop/website/public/
|
||
|
|
- Reloaded nginx with: sudo systemctl reload nginx
|
||
|
|
|
||
|
|
✅ 4. CSS Fix Applied
|
||
|
|
- Added .sticky-banner-wrapper { position: sticky; top: 0; z-index: 1000; }
|
||
|
|
- Navbar now stays fixed when scrolling
|
||
|
|
|
||
|
|
HOW TO APPLY FUTURE CHANGES:
|
||
|
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||
|
|
When you make CSS/JS changes that aren't reflecting:
|
||
|
|
|
||
|
|
1. UPDATE VERSION NUMBER (automatic):
|
||
|
|
NEW_VERSION=$(date +%s)
|
||
|
|
cd /media/pts/Website/SkyArtShop/website/public
|
||
|
|
for file in *.html; do
|
||
|
|
sed -i "s|navbar\.css?v=[0-9]*|navbar.css?v=$NEW_VERSION|g" "$file"
|
||
|
|
sed -i "s|main\.css?v=[0-9]*|main.css?v=$NEW_VERSION|g" "$file"
|
||
|
|
done
|
||
|
|
|
||
|
|
2. RESTART BACKEND (clears backend cache):
|
||
|
|
pm2 restart skyartshop
|
||
|
|
|
||
|
|
3. CLEAR BROWSER CACHE:
|
||
|
|
Hard refresh: Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (Mac)
|
||
|
|
|
||
|
|
VERIFICATION CHECKLIST:
|
||
|
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||
|
|
✓ Backend online: PM2 PID 458772, status: online
|
||
|
|
✓ Nginx active: Configuration OK
|
||
|
|
✓ CSS serving: HTTP 200 with new version
|
||
|
|
✓ HTML updated: All 14 pages have v=1768448784
|
||
|
|
✓ Sticky navbar: CSS contains .sticky-banner-wrapper
|
||
|
|
|
||
|
|
The triple-layer caching issue is now permanently documented and solved!
|