79352247

Date: 2025-01-13 12:59:22
Score: 1.5
Natty:
Report link

Answer

The issue was related to Cloudflare caching, not the Flutter service worker itself. Here's what was happening and how to fix it:

Root Cause

Even though the service worker version was updating correctly in the flutter_bootstrap_js, Cloudflare was serving cached versions of the assets, preventing the new version from being loaded immediately.

Solution

To resolve this issue, you need to:

  1. Clear Cloudflare's cache:

    • Go to Cloudflare dashboard
    • Select your domain
    • Navigate to "Caching" > "Configuration"
    • Click "Purge Cache" > "Purge Everything"
  2. (Optional) During development, you can:

    • Enable Development Mode in Cloudflare temporarily
    • Or create a Page Rule to bypass cache for specific URLs

Additional Notes

Hope this helps others who might face similar issues with Flutter web deployments behind Cloudflare!

Tags: cloudflare, flutter-web, caching, cdn

Reasons:
  • Whitelisted phrase (-1): Hope this helps
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): face similar issue
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Jaesang Song