Plugin Contributor
iSaumya
(@isaumya)
Hi @royrogers,
First of all thanks for the message. After reading your message, I went to a very deep rabbit hole to figure out the reason behind the outcome you reported – as I could replicate the same. But the reasoning you gave behind it made no sense as I knew it cannot be the cause of what you are experiencing.
Anyways after hours of looking at the code and debugging for hours, I finally figured out what was causing the problem.
The short answer is if you switch to the worker mode you won’t face this problem – this experience is only existing in the default page rule based caching.
Now let me explain why that is. You see when you use the default page rule based caching mechanism, it must have to use a cache buster (default swcfpc=1) to bypass the cache for the loggedin users.
Now imaging you have loggedin to the WP Admin. You right clicked on the name of your site showing in the top black bar and you select open in new tab. You will see that your site homepage will open with the cache buster ?swcfpc=1 attached to it.
Now normally at this point if you click on any of the internal link of the site it should open without the cache buster added to it. Toi mitigate this issue. When you are using the default page rule mode and you are viewing the website as a loggedin user, the plugin runs a small JS code to automatically add swcfpc=1 cache buster to all inter links.
This is why as a loggedin user you have a seamless experience cause all internal links will have auto cache buster added to the end of the URL. This is where the problem comes. The custom instantpage based prefecth does work because at the time of page load whatever the URL was after the page load using the JS the cache buster was added to the URLs and hence the URLs has been changed. This causes the prefetch not to invoke.
Alternatively if you enable the worker mode inside the plugin which doesn’t add any cache buster but rather use much sophisticated caching logic – you won’t face this issue as no URLs are ever getting changed via JS.
I hope this helps.
Hi there!
Thank you very much for your reply.
I will try the workers mode
Thanks!
I forgot something regarding the no-store reason I mentioned.
I had the same issue using instant.page with perfmatters, flying pages and wp-rocket preloading pages.
For the Flying pages plugin to work there is a “no-store” compatibility check on their settings. If the “no-store” control cache is present, the prefetch cache doesnt work. read more here:
https://ww.wp.xz.cn/support/topic/flying-pages-seems-to-not-be-working-in-my-website/
https://ww.wp.xz.cn/support/topic/no-store-is-found-in-your-cache-control/
Thank you
Plugin Contributor
iSaumya
(@isaumya)
But that does not seem to be the case with our custom modified version of instantpage code as it is working when using worker mode which doesn’t have the requirement of dynamically changing the URL.