• Resolved asafm7

    (@asafm7)


    Hi,

    The plugin seems to cache (using service workers) in the 3 following problematic cases:

    1. Front-end pages, while logged-in as admin (meaning, when viewing the site as an admin, with the black bar on top)
    2. 307 redirects
    3. Pages excluded from caching using my cache plugin (LiteSpeed Cache)

    All of these are excluded from caching by my cache plugin (LiteSpeed Cache), and they are all solved if checking: DevTools -> Application -> Service Workers -> Bypass for network

    To check 2 and 3, you can go to my site, and click “Shuffle” to the right (below the title “Filters”). Every click is supposed to bring a new set of hobbies. You can check the network tab in DevTools to see the sequence.

    https://simply-hobbies.com/

    What are the possible solutions?

    Thanks,
    Asaf

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    1. Front-end pages, while logged-in as admin (meaning, when viewing the site as an admin, with the black bar on top)

    For that see:

    https://github.com/GoogleChromeLabs/pwa-wp/issues/252
    https://github.com/GoogleChromeLabs/pwa-wp/issues/363#issuecomment-743571066

    To check 2 and 3, you can go to my site, and click “Shuffle” to the right (below the title “Filters”). Every click is supposed to bring a new set of hobbies. You can check the network tab in DevTools to see the sequence.

    This is strange, because you’re using the NetworkFirst strategy and this is only supposed to cache a 200 status code, not 307: https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-strategies.NetworkFirst

    3. Pages excluded from caching using my cache plugin (LiteSpeed Cache)

    Server-side caching is independent of client-side caching with the service worker.

    Plugin Author Weston Ruter

    (@westonruter)

    Thanks to Jeff Posnick from the Workbox team for pointing this out to me: the reason the old responses are being served is because the server is taking longer than 2 seconds, as you even show with a tooltip:

    By default the plugin is configured to serve the cached response if it takes longer than 2 seconds. This is to help ensure that the user experience falls within the “GOOD” range for Largest Contentful Paint (LCP) from the Core Web Vitals (CWV).

    You can override this with a filter, like the following PHP plugin code which increases the timeout to 10 seconds:

    add_filter( 'wp_service_worker_navigation_caching', function ( $config ) {
    	$config['network_timeout_seconds'] = 10;
    	return $config;
    } );
    • This reply was modified 3 years, 9 months ago by Weston Ruter.
    • This reply was modified 3 years, 9 months ago by Weston Ruter.
    Thread Starter asafm7

    (@asafm7)

    It seems to solve the issue.

    Thanks @westonruter

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cache issues’ is closed to new replies.