Support » Plugin: Page Speed Optimization » Service worker fails chrome audit when run off start_url

  • Resolved sirtaptap


    First, wanted to say I really love this plugin, it’s helped my site’s speed immensely and is almost the only serviceworker plugin that even exists.

    Now, I managed to load the abtfpwa.js serviceworker along with OneSignal’s push notifications serviceworker and got them running alongside each other. But I have one last issue with abtf’s service worker: Chrome’s Lighthouse audit tool suggests that the start_url isn’t cached, even though I explicitly cache it in the Cache Preload section on the PWA tab of Above The Fold’s settings.

    At first I thought it was just a false positive, since if I test offline caching manually it DOES work. However, when I install the site as an app on my android, it regularly fails to load if I’m not connected online saying “this app needs to be online for the first run”, even when it’s been run several times before. I never got that message using the (now abandoned) Offline Content serviceworker plugin from Mozilla.

    The curious thing is if I run the audit from the start URL (, the audit passes. If I run it from the homepage or any other page, it fails. If I change the start url to / then it passes on the homepage, fails everywhere else, etc.

    I feel like I must have messed up a configuration somehow, but is it known what could cause this situation? My scope in my manifest seems to be set correctly, and like I said if I test chrome offline after letting the serviceworker preload, my start_url actually is preloaded. Can’t tell what the deal is

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author


    Hi sirtaptap,

    Thank you very much for your feedback!

    The Service Worker solution has been quickly setup, it will be done with a higher quality in our upcoming Advanced Optimization plugin.

    After some research we discovered that the ABTF Service Worker does cache the start_url correctly but that the Google Lighthouse test produced a false negative. Google reports the following regarding the issue:

    One shortcoming of this audit is that it inspects the cache contents directly, rather than asking the service worker to resolve the start_url request. This can produce a false negative result if your cache is missing a resource that matches the exact value of start_url, even though in real scenarios the request resolves successfully because the service worker redirects to another resource in the cache. Conversely, the audit can produce a false positive result if your cache contains a resource that matches start_url, but your service worker redirects the request to a non-existent resource.

    We’ve filed a issue at Github:

    Great to know! I like the new name too, more accurately reflects what it is and should help convey to the user that it’s not a turnkey app. I’ve had a blast optimizing myself with it btw, even if JS can be very fussy with execution order; hardly your fault.

    Seems like the new “register service worker after preload” option causes the audit to pass too. Doesn’t seem like there’s any significant performance reason not to?

    • This reply was modified 1 year, 9 months ago by sirtaptap.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Service worker fails chrome audit when run off start_url’ is closed to new replies.